Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class _MyAppState extends State<MyApp> {
- @override
- Widget build(BuildContext context) {
- return FutureBuilder<bool>(
- future: get_login(),
- builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
- if (snapshot.connectionState == ConnectionState.done) {
- if (snapshot.data == false) {
- //tidak ada akun login
- return FutureBuilder(
- future: Hive.openBox('pgguna'),
- builder: (context, snapshot) {
- if (snapshot.connectionState == ConnectionState.done) {
- if (snapshot.hasError) {
- return Scaffold(
- body: Container(
- child: Center(
- child: Text(snapshot.error.toString()),
- ),
- ),
- );
- }
- return MaterialApp(
- home: Scaffold(
- body: WatchBoxBuilder(
- box: pguna,
- builder: (context, pguna) => ListView.builder(
- itemCount: pguna.length,
- itemBuilder: (context, index) {
- pengguna ujip = pguna.getAt(index);
- return Text(ujip.foto_p);
- },
- ),
- ),
- ),
- );
- }
- return MaterialApp(
- home: Scaffold(
- body: Container(
- child: Center(
- child: CupertinoActivityIndicator(),
- ),
- ),
- ),
- );
- },
- );
- }
- return FutureBuilder(
- future: Hive.openBox('pgguna'),
- builder: (context, snapshot) {
- if (snapshot.connectionState == ConnectionState.done) {
- if (snapshot.hasError) {
- return Scaffold(
- body: Container(
- child: Center(
- child: Text(snapshot.error.toString()),
- ),
- ),
- );
- }
- get_akun().then((s) {
- no_hp_p = s;
- });
- return WatchBoxBuilder(
- box: pguna,
- builder: (context, pguna) => ListView.builder(
- itemCount: pguna.length,
- itemBuilder: (context, index) {
- pengguna ujip = pguna.getAt(index);
- return Text(ujip.foto_p);
- },
- ),
- );
- }
- return MaterialApp(
- home: Scaffold(
- body: Container(
- child: Center(
- child: CupertinoActivityIndicator(),
- ),
- ),
- ),
- );
- },
- );
- }
- return MaterialApp(
- home: Scaffold(
- body: Container(
- child: Center(
- child: CupertinoActivityIndicator(),
- ),
- ),
- ),
- );
- },
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement