geo-smart-app/lib/page/startup.dart
Supan Adit Pratama 3ead80b465 Migrate to Android X
Update some Dependencies
Logo Added
Start and Stop Tracking Button
Optimize Code
Stable Version
2020-01-03 22:13:00 +07:00

65 lines
1.4 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:geo_app/bloc/setting.dart';
import 'package:geo_app/component/loader.dart';
import 'package:geo_app/page/map.dart';
import 'package:geo_app/page/setting.dart';
class Startup extends StatefulWidget {
@override
State createState() {
return new _StartupState();
}
}
class _StartupState extends State<Startup> {
SettingBloc _settingBloc;
@override
void initState() {
_settingBloc = new SettingBloc();
_settingBloc.getSetting();
_settingBloc.subject.listen((settingModel) {
if (settingModel.isNullHost() && settingModel.isNullId()) {
Navigator.of(context).pushReplacement(new MaterialPageRoute(
builder: (BuildContext context) => Setting(),
));
} else {
Navigator.of(context).pushReplacement(new MaterialPageRoute(
builder: (BuildContext context) => Map(),
));
}
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
child: Column(
children: <Widget>[
Loader(),
SizedBox(
height: 20.0,
),
Text("Preparing System")
],
),
height: 50,
),
),
);
}
@override
void dispose() {
_settingBloc.dispose();
super.dispose();
}
}