import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; class ReferPage extends StatefulWidget { final String? accountType; const ReferPage({Key? key, this.accountType}) : super(key: key); @override _ReferPageState createState() => _ReferPageState(accountType: this.accountType); } class _ReferPageState extends State { String? accountType; _ReferPageState({this.accountType}); var usern = new TextEditingController(); bool visibleT = true; var password = new TextEditingController(); bool loading = false; bool error = false; bool rememberMe = false; bool success = false; String? usernameFor; @override void dispose() { super.dispose(); } @override Widget build(BuildContext context) { return Dialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(Consts.padding), ), elevation: 0.0, backgroundColor: Colors.transparent, child: SingleChildScrollView( scrollDirection: Axis.vertical, child: Stack( children: [ Container( padding: EdgeInsets.only( top: Consts.avatarRadius + Consts.padding, bottom: Consts.padding, left: Consts.padding, right: Consts.padding, ), margin: EdgeInsets.only(top: Consts.avatarRadius), decoration: new BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(Consts.padding), boxShadow: [ BoxShadow( color: Colors.black26, blurRadius: 10.0, offset: const Offset(0.0, 10.0), ), ], ), child: Column( mainAxisSize: MainAxisSize.min, // To make the card compact children: [ Visibility( visible: visibleT, child: Text( "Error", textAlign: TextAlign.center, style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.w700, color: Colors.red, ), ), ), SizedBox(height: 16.0), Text( "Sorry your account is connected to " + accountType! + ", login using the " + accountType! + " button ", textAlign: TextAlign.center, style: TextStyle( fontSize: 12.0, color: Colors.black87, ), ), SizedBox(height: 14.0), Align( alignment: Alignment.bottomRight, child: TextButton( onPressed: () { Navigator.of(context).pop(); // To close the dialog }, child: Text( "OK", style: TextStyle( color: Colors.black87, ), ), ), ), Visibility( visible: loading, child: Align( alignment: Alignment.bottomCenter, child: CupertinoActivityIndicator( animating: true, radius: 15, ), ), ), ], ), ), Positioned( left: Consts.padding, right: Consts.padding, child: CircleAvatar( child: Icon( Icons.cancel, color: Colors.red, size: 100, ), backgroundColor: Colors.white, radius: Consts.avatarRadius, ), ), ], ), ), ); } } class Consts { Consts._(); static const double padding = 16.0; static const double avatarRadius = 55.0; }