-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow barrier dismiss in dialogs (#3)
This add the builder option and possibility to allow dialog dismissal via backdrop press. Be aware that Scaffold and Material App are full screen by default. So to use a "small modal" of some sort, you need to provide theme data or use "Material" widgets to provide defaults. (e.g. in the example app)
- Loading branch information
Showing
10 changed files
with
191 additions
and
48 deletions.
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,35 @@ | ||
import 'package:fluorflow/annotations.dart'; | ||
import 'package:fluorflow/fluorflow.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
@DialogConfig( | ||
routeBuilder: RouteBuilder.topToBottomFade, defaultBarrierDismissible: true) | ||
final class SmallDialog extends FluorFlowSimpleDialog<void> { | ||
const SmallDialog({super.key, required super.completer}); | ||
|
||
@override | ||
Widget build(BuildContext context) => Center( | ||
child: Container( | ||
padding: const EdgeInsets.all(16), | ||
decoration: BoxDecoration( | ||
color: Colors.white, | ||
borderRadius: BorderRadius.circular(8), | ||
), | ||
child: Material( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
const Text('Dialog Page'), | ||
const Text('Close via button or click into background'), | ||
const SizedBox(height: 36), | ||
ElevatedButton( | ||
onPressed: completer.confirm, | ||
child: const Text('Close'), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} |
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
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
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
Oops, something went wrong.