Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() => runApp(MyApp());
- class MyApp extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Flutter Demo',
- theme: ThemeData(
- primarySwatch: Colors.blue,
- ),
- home: MyHomePage(title: 'Flutter Demo Home Page'),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- MyHomePage({Key key, this.title}) : super(key: key);
- final String title;
- @override
- _MyHomePageState createState() => _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- Page progressDialog = Page.getProgressDialog();
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text(widget.title),
- ),
- body: Stack(
- children: <Widget>[
- Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- RaisedButton(
- onPressed: (){
- progressDialog.showProgress();
- },
- child: Text('Show dialog'),
- )
- ],
- ),
- ),
- progressDialog,
- ],
- ),
- );
- }
- }
- //---------------------------------------
- class Page extends StatefulWidget {
- PageState seguimientoDialogState;
- @override
- createState() => seguimientoDialogState = new PageState();
- void showProgress() {
- seguimientoDialogState.showProgress();
- }
- static Widget getProgressDialog() {
- return new Page();
- }
- }
- class PageState extends State <Page> {
- bool _opacity = false;
- @override
- void initState() {
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return new Container(
- child: !_opacity
- ? null
- : new Opacity(
- opacity: _opacity ? 1.0 : 0.0,
- child: new Container(
- color: Colors.black54,
- child: new Stack(
- children: <Widget>[
- new Center(
- child: Stack(
- children: <Widget>[
- Padding(
- padding: EdgeInsets.all(4.0),
- child: Card(
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10.0),
- ),
- child: Container(
- width: MediaQuery.of(context).size.width-50.0,
- height: MediaQuery.of(context).size.height-100.0,
- padding: EdgeInsets.all(10.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.all(5.0),
- child: Container(
- child: Text('test'),
- color: Colors.green[100],
- )
- ),
- ],
- ),
- ),
- ),
- ),
- Positioned(
- top: .0,
- right: .0,
- child: InkWell(
- //child: Image.asset('assets/close_alt.png',width: 25.0,),
- child: Icon(Icons.close, color:Colors.black, size: 25.0),
- onTap: () {
- setState(() {
- _opacity=false;
- });
- },
- ),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- )
- );
- }
- void showProgress() {
- setState(() {
- _opacity = true;
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement