New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for full screen dialogs #104961
Comments
Part of #91605 |
This is required for #106101, looking at what is needed to make this feature possible. |
Do you think creating a new We can create a fullscreen dialog using Dialog widget with some zero Code Sampleimport 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key, this.dark = true, this.useMaterial3 = true});
final bool dark;
final bool useMaterial3;
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
themeMode: dark ? ThemeMode.dark : ThemeMode.light,
theme: ThemeData(
useMaterial3: useMaterial3,
brightness: Brightness.light,
colorSchemeSeed: const Color(0xff6750a4),
),
darkTheme: ThemeData(
useMaterial3: useMaterial3,
brightness: Brightness.dark,
colorSchemeSeed: const Color(0xff6750a4),
),
home: const DialogExample(),
);
}
}
class DialogExample extends StatelessWidget {
const DialogExample({super.key});
Future<void> _dialog(BuildContext context) async {
return showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
insetPadding: EdgeInsets.zero,
child: Scaffold(
appBar: AppBar(
title: const Text('Full-screen dialog title'),
centerTitle: false,
automaticallyImplyLeading: false,
leading: IconButton(
onPressed: () => Navigator.of(context).pop(),
icon: const Icon(Icons.close),
),
actions: <Widget>[
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Save'),
),
],
),
),
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Dialog'),
),
body: Center(
child: ElevatedButton(
onPressed: () => _dialog(context),
child: const Text('Open Full-screen Dialog'),
),
),
);
}
}
Screen.Recording.2022-07-13.at.13.49.40.mov |
It does look very close, but not quite up to spec (save button padding). I do like Can you add some content to the example? I'd like to see how close to spec we are by default. |
Dialog is actually an unopinionated dialog. In the Flutter context, AlertDialog is the dialog that provides the ability title, message, and actions buttons and the M3 Fullscreen dialog is similar to that but of course fullscreen. Also, AlertDialog has quite many parameters that are not related to Fullscreen Dialog In this case, creating a new Previously I migrated AlertDialog to M3 with tokens. |
Agreed that AlertDialog isn't the way to go for this. Since Dialog
I'm not sure I understand this. Since Also, if you overlay the sample with the spec, is the padding around the button the only padding difference? |
That's what I thought at first, given Android doesn't provide a concrete fullscreen implementation. According to Dialogs - Full-screen dialogs and tokens, there needs to be a header with the title with app bar like height, the closing icon, and action text button and it should also elevate on the scroll and a divider.
Could we leave all this full-screen dialog design for the users to match the specs? I think the new |
Both options are valid, but I suspect the customizeability of full screen dialogs is more important than providing an exact match to spec. I'd lean towards the |
Thanks so much! This helps a lot. |
I was about to file a new issue for this :) Is someone working on this up? |
@pedromassango |
@pedromassango |
That is great 🏅 |
Update: |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Spec
The text was updated successfully, but these errors were encountered: