|
|
|
|
@ -11,12 +11,12 @@ import '../../widgets/auth/login_form.dart';
|
|
|
|
|
import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
|
|
|
|
|
|
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
|
|
|
|
|
|
class Loginsreen extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_LoginsreenState createState() => _LoginsreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class _LoginsreenState extends State<Loginsreen> {
|
|
|
|
|
Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
|
|
|
|
|
|
|
|
|
|
@ -25,7 +25,7 @@ class _LoginsreenState extends State<Loginsreen> {
|
|
|
|
|
Future<String> platformImeiFuture;
|
|
|
|
|
|
|
|
|
|
Future<void> getSharedPref() async {
|
|
|
|
|
sharedPref.getString('platformImei').then((imei){
|
|
|
|
|
sharedPref.getString('platformImei').then((imei) {
|
|
|
|
|
platformImei = imei;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -42,45 +42,46 @@ class _LoginsreenState extends State<Loginsreen> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
getSharedPref();
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: FutureBuilder(
|
|
|
|
|
future: platformImeiFuture,
|
|
|
|
|
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
|
|
|
|
|
switch (snapshot.connectionState) {
|
|
|
|
|
case ConnectionState.waiting:
|
|
|
|
|
return DrAppCircularProgressIndeicator();
|
|
|
|
|
default:
|
|
|
|
|
if (snapshot.hasError) {
|
|
|
|
|
return Text('Error: ${snapshot.error}');
|
|
|
|
|
} else {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0),
|
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
(platformImei == null)
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: ListView(children: <Widget>[
|
|
|
|
|
FutureBuilder(
|
|
|
|
|
future: platformImeiFuture,
|
|
|
|
|
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
|
|
|
|
|
switch (snapshot.connectionState) {
|
|
|
|
|
case ConnectionState.waiting:
|
|
|
|
|
return DrAppCircularProgressIndeicator();
|
|
|
|
|
default:
|
|
|
|
|
if (snapshot.hasError) {
|
|
|
|
|
return Text('Error: ${snapshot.error}');
|
|
|
|
|
} else {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0),
|
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
(platformImei == null)
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AuthHeader(loginType.knownUser),
|
|
|
|
|
LoginForm(),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AuthHeader(loginType.unknownUser),
|
|
|
|
|
KnownUserLogin(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
LoginForm(),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AuthHeader(loginType.unknownUser),
|
|
|
|
|
KnownUserLogin(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|