Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pop up window flutter

   import 'package:flutter/material.dart';

void main() {
  runApp(new MaterialApp(home: new MyApp()));
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _formKey = GlobalKey<FormState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Flutter"),
      ),
      body: Center(
        child: RaisedButton(
          onPressed: () {
            showDialog(
                context: context,
                builder: (BuildContext context) {
                  return AlertDialog(
                    content: Stack(
                      overflow: Overflow.visible,
                      children: <Widget>[
                        Positioned(
                          right: -40.0,
                          top: -40.0,
                          child: InkResponse(
                            onTap: () {
                              Navigator.of(context).pop();
                            },
                            child: CircleAvatar(
                              child: Icon(Icons.close),
                              backgroundColor: Colors.red,
                            ),
                          ),
                        ),
                        Form(
                          key: _formKey,
                          child: Column(
                            mainAxisSize: MainAxisSize.min,
                            children: <Widget>[
                              Padding(
                                padding: EdgeInsets.all(8.0),
                                child: TextFormField(),
                              ),
                              Padding(
                                padding: EdgeInsets.all(8.0),
                                child: TextFormField(),
                              ),
                              Padding(
                                padding: const EdgeInsets.all(8.0),
                                child: RaisedButton(
                                  child: Text("Submitß"),
                                  onPressed: () {
                                    if (_formKey.currentState.validate()) {
                                      _formKey.currentState.save();
                                    }
                                  },
                                ),
                              )
                            ],
                          ),
                        ),
                      ],
                    ),
                  );
                });
          },
          child: Text("Open Popup"),
        ),
      ),
    );
  }
}
Comment

PREVIOUS NEXT
Code Example
Python :: splitting strings in python 
Python :: How to Replace substrings in python 
Python :: swapping variables 
Python :: ValueError: only one element tensors can be converted to Python scalars 
Python :: define event on socketio python 
Python :: NumPy roll Syntax 
Python :: get midnight of current day python 
Python :: pass variable to thread target 
Python :: python read xlsx file 
Python :: python classes and objects 
Python :: inheritance in python 3 example 
Python :: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. 
Python :: puython is not equal to 
Python :: set time complexity python 
Python :: python inline if 
Python :: pandas find fifth caracter in field and change cell based on that number 
Python :: how to write user input to a file in python 
Python :: desktop notifier in python 
Python :: randint 
Python :: lcd of 18 and 21 
Python :: Python List clear() 
Python :: opening a file in python 
Python :: python test coverage 
Python :: docstring in python 
Python :: How can I get the named parameters from a URL using Flask? 
Python :: convert exception to string python 
Python :: list peek python 
Python :: python web scraping 
Python :: matplotlib window size 
Python :: greater and less than in python 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =