Created
April 18, 2022 04:36
-
-
Save triyono777/593b19864e4136fbeb30884d55a889ad 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 'package:projek_kel_1/login_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: SizedBox( | |
width: 250, | |
height: 50, | |
child: ElevatedButton( | |
style: ElevatedButton.styleFrom( | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(30), | |
), | |
), | |
onPressed: () { | |
var box = Hive.box('userBox').clear(); | |
Navigator.of(context).push( | |
MaterialPageRoute(builder: (_) => LoginScreen()), | |
); | |
}, | |
child: Text('Logout'), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment