Skip to content

Instantly share code, notes, and snippets.

@furkantektas
Created June 25, 2023 01:39
Show Gist options
  • Save furkantektas/4fda4cef416a20760cdd1aa86fba637a to your computer and use it in GitHub Desktop.
Save furkantektas/4fda4cef416a20760cdd1aa86fba637a to your computer and use it in GitHub Desktop.
Flutter Material 3 full screen dialog
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark()
.copyWith(scaffoldBackgroundColor: darkBlue, useMaterial3: true),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: OutlinedButton(
onPressed: () {
showDialog(
context: context,
builder: (context) {
return Dialog.fullscreen(
backgroundColor: Colors.white,
child: Center(
child: TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text("Close")),
),
);
});
},
child: const Text("Open fullscreen dialog")));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment