Created
April 16, 2022 09:03
-
-
Save triyono777/c8331d796e55c3f97f2b368ce85d6700 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:hive_flutter/hive_flutter.dart'; | |
import 'welcome_screen.dart'; | |
class HomeScreen extends StatelessWidget { | |
const HomeScreen({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Home Screen'), | |
), | |
body: Center( | |
child: Column( | |
children: [ | |
Text('Hello'), | |
ElevatedButton( | |
onPressed: () { | |
var box = Hive.box('userBox').clear(); | |
Navigator.of(context).pushReplacement( | |
MaterialPageRoute(builder: (_) => WelcomeScreen()), | |
); | |
}, | |
child: Text('Logout'), | |
), | |
], | |
)), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment