|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +import 'package:flutter/material.dart'; |
| 20 | + |
| 21 | +import '../../../playground_components.dart'; |
| 22 | + |
| 23 | +// TODO(nausharipov): review: dialog or popup? |
| 24 | +class BeamAlertDialog extends StatelessWidget { |
| 25 | + final String? body; |
| 26 | + final String continueLabel; |
| 27 | + final VoidCallback onContinue; |
| 28 | + final String title; |
| 29 | + |
| 30 | + const BeamAlertDialog({ |
| 31 | + this.body, |
| 32 | + required this.continueLabel, |
| 33 | + required this.onContinue, |
| 34 | + required this.title, |
| 35 | + }); |
| 36 | + |
| 37 | + @override |
| 38 | + Widget build(BuildContext context) { |
| 39 | + return OverlayBody( |
| 40 | + child: Container( |
| 41 | + width: BeamSizes.popupWidth, |
| 42 | + padding: const EdgeInsets.all(BeamSizes.size16), |
| 43 | + child: Column( |
| 44 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 45 | + mainAxisSize: MainAxisSize.min, |
| 46 | + children: [ |
| 47 | + Text( |
| 48 | + title, |
| 49 | + style: Theme.of(context).textTheme.headlineMedium, |
| 50 | + ), |
| 51 | + if (body != null) |
| 52 | + Padding( |
| 53 | + padding: const EdgeInsets.only(top: BeamSizes.size8), |
| 54 | + child: Text(body!), |
| 55 | + ), |
| 56 | + const SizedBox(height: BeamSizes.size8), |
| 57 | + Row( |
| 58 | + mainAxisAlignment: MainAxisAlignment.end, |
| 59 | + children: [ |
| 60 | + TextButton( |
| 61 | + onPressed: () { |
| 62 | + Navigator.pop(context); |
| 63 | + }, |
| 64 | + // TODO(nausharipov): review: translate in PGC? |
| 65 | + child: const Text('Cancel'), |
| 66 | + ), |
| 67 | + const SizedBox(width: BeamSizes.size8), |
| 68 | + TextButton( |
| 69 | + onPressed: onContinue, |
| 70 | + child: Text(continueLabel), |
| 71 | + ), |
| 72 | + ], |
| 73 | + ), |
| 74 | + ], |
| 75 | + ), |
| 76 | + ), |
| 77 | + ); |
| 78 | + } |
| 79 | +} |
0 commit comments