Created
          June 25, 2023 01:39 
        
      - 
      
- 
        Save furkantektas/4fda4cef416a20760cdd1aa86fba637a to your computer and use it in GitHub Desktop. 
    Flutter Material 3 full screen dialog
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | 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