Last active
December 7, 2021 13:31
-
-
Save AbbasHoseini/8870f8081ed700a31ab164aae6caf8f6 to your computer and use it in GitHub Desktop.
کد مدیریت state- 1
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
class MyHomepage extends StatefulWidget { | |
const MyHomepage({Key? key}) : super(key: key); | |
@override | |
_MyHomepageState createState() => _MyHomepageState(); | |
} | |
class _MyHomepageState extends State { | |
int _index = 0; | |
@override | |
Widget build(BuildContext context) { | |
return BottomNavigationBar( | |
currentIndex: _index, | |
onTap: (newIndex) { | |
setState(() { | |
_index = newIndex; | |
}); | |
}, | |
// ... items ... | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment