-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create showZetaDialog * finished dialog for DeviceType.mobilePortrait * dialog variant for bigger screens * create widgetbook; add Zeta parameter, also in ZetaButton * useRootNavigator: false
- Loading branch information
1 parent
671fcc1
commit 7b762e6
Showing
8 changed files
with
437 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:zeta_example/widgets.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
class DialogExample extends StatelessWidget { | ||
static const String name = 'Dialog'; | ||
|
||
const DialogExample({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final zeta = Zeta.of(context); | ||
return ExampleScaffold( | ||
name: 'Dialog', | ||
child: Center( | ||
child: Column( | ||
children: [ | ||
TextButton( | ||
onPressed: () => showZetaDialog( | ||
context, | ||
useRootNavigator: false, | ||
title: 'Dialog Title', | ||
icon: Icon( | ||
ZetaIcons.warning_round, | ||
color: zeta.colors.warning, | ||
), | ||
message: | ||
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.', | ||
primaryButtonLabel: 'Confirm', | ||
), | ||
child: Text('Show dialog with one button'), | ||
), | ||
TextButton( | ||
onPressed: () => showZetaDialog( | ||
context, | ||
useRootNavigator: false, | ||
title: 'Dialog Title', | ||
icon: Icon( | ||
ZetaIcons.warning_round, | ||
color: zeta.colors.warning, | ||
), | ||
message: | ||
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.', | ||
primaryButtonLabel: 'Confirm', | ||
secondaryButtonLabel: 'Cancel', | ||
), | ||
child: Text('Show dialog with two buttons'), | ||
), | ||
TextButton( | ||
onPressed: () => showZetaDialog( | ||
context, | ||
useRootNavigator: false, | ||
title: 'Dialog Title', | ||
icon: Icon( | ||
ZetaIcons.warning_round, | ||
color: zeta.colors.warning, | ||
), | ||
message: | ||
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.', | ||
primaryButtonLabel: 'Confirm', | ||
secondaryButtonLabel: 'Cancel', | ||
tertiaryButtonLabel: 'Learn more', | ||
onTertiaryButtonPressed: () {}, | ||
), | ||
child: Text('Show dialog with three buttons'), | ||
), | ||
TextButton( | ||
onPressed: () => showZetaDialog( | ||
context, | ||
useRootNavigator: false, | ||
title: 'Dialog Title', | ||
icon: Icon( | ||
ZetaIcons.warning_round, | ||
color: zeta.colors.warning, | ||
), | ||
message: | ||
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.', | ||
headerAlignment: ZetaDialogHeaderAlignment.left, | ||
primaryButtonLabel: 'Confirm', | ||
secondaryButtonLabel: 'Cancel', | ||
rounded: false, | ||
), | ||
child: Text( | ||
'Show dialog with header to the left\nand sharp buttons', | ||
textAlign: TextAlign.center, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
example/widgetbook/pages/components/dialog_widgetbook.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
import '../../test/test_components.dart'; | ||
|
||
Widget dialogUseCase(BuildContext context) { | ||
final zeta = Zeta.of(context); | ||
final title = context.knobs.string( | ||
label: 'Dialog title', | ||
initialValue: 'Dialog Title', | ||
); | ||
final message = context.knobs.string( | ||
label: 'Dialog message', | ||
initialValue: | ||
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.', | ||
); | ||
final rounded = context.knobs.boolean(label: 'Rounded', initialValue: true); | ||
final barrierDismissible = context.knobs.boolean(label: 'Barrier dismissible', initialValue: true); | ||
final headerAlignment = context.knobs.list<ZetaDialogHeaderAlignment>( | ||
label: 'Header alignment', | ||
options: ZetaDialogHeaderAlignment.values, | ||
labelBuilder: (value) => value.name, | ||
); | ||
return WidgetbookTestWidget( | ||
widget: Padding( | ||
padding: const EdgeInsets.all(ZetaSpacing.x5), | ||
child: Center( | ||
child: Column( | ||
children: [ | ||
TextButton( | ||
onPressed: () => showZetaDialog( | ||
context, | ||
useRootNavigator: false, | ||
zeta: zeta, | ||
rounded: rounded, | ||
barrierDismissible: barrierDismissible, | ||
headerAlignment: headerAlignment, | ||
title: title, | ||
icon: Icon( | ||
ZetaIcons.warning_round, | ||
color: zeta.colors.warning, | ||
), | ||
message: message, | ||
primaryButtonLabel: 'Confirm', | ||
), | ||
child: Text('Show dialog with one button'), | ||
), | ||
TextButton( | ||
onPressed: () => showZetaDialog( | ||
context, | ||
useRootNavigator: false, | ||
zeta: zeta, | ||
rounded: rounded, | ||
barrierDismissible: barrierDismissible, | ||
headerAlignment: headerAlignment, | ||
title: title, | ||
icon: Icon( | ||
ZetaIcons.warning_round, | ||
color: zeta.colors.warning, | ||
), | ||
message: message, | ||
primaryButtonLabel: 'Confirm', | ||
secondaryButtonLabel: 'Cancel', | ||
), | ||
child: Text('Show dialog with two buttons'), | ||
), | ||
TextButton( | ||
onPressed: () => showZetaDialog( | ||
context, | ||
useRootNavigator: false, | ||
zeta: zeta, | ||
rounded: rounded, | ||
barrierDismissible: barrierDismissible, | ||
headerAlignment: headerAlignment, | ||
title: title, | ||
icon: Icon( | ||
ZetaIcons.warning_round, | ||
color: zeta.colors.warning, | ||
), | ||
message: message, | ||
primaryButtonLabel: 'Confirm', | ||
secondaryButtonLabel: 'Cancel', | ||
tertiaryButtonLabel: 'Learn more', | ||
onTertiaryButtonPressed: () {}, | ||
), | ||
child: Text('Show dialog with three buttons'), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.