Instantly share code, notes, and snippets.
Created
December 19, 2019 15:16
-
Star
(0)
0
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save haidar786/9284ee57d6faad3585b121b476eb9c04 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
void main() => runApp(MyApp()); | |
class MyApp extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
return MyAppState(); | |
} | |
} | |
enum Options { referrals, stats, editProfile } | |
class MyAppState extends State<MyApp> { | |
var option = Options.referrals; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
body: Padding( | |
padding: const EdgeInsets.all(50.0), | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Card( | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(10.0), | |
), | |
color: Colors.blue, | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
children: <Widget>[ | |
Padding( | |
padding: const EdgeInsets.all(4.0), | |
child: InkWell( | |
child: Container( | |
decoration: BoxDecoration( | |
color: option == Options.referrals | |
? Colors.white | |
: Colors.transparent, | |
borderRadius: BorderRadius.only( | |
topLeft: Radius.circular(10), | |
bottomLeft: Radius.circular(10))), | |
child: Center( | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Text( | |
"Refferals", | |
style: TextStyle( | |
color: option == Options.referrals | |
? Colors.blue | |
: Colors.white), | |
), | |
), | |
), | |
), | |
onTap: () { | |
setState(() { | |
option = Options.referrals; | |
}); | |
}, | |
), | |
), | |
Padding( | |
padding: const EdgeInsets.all(4.0), | |
child: InkWell( | |
child: Container( | |
decoration: BoxDecoration( | |
color: option == Options.stats | |
? Colors.white | |
: Colors.transparent, | |
), | |
child: Center( | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Text( | |
"Stats", | |
style: TextStyle( | |
color: option == Options.stats | |
? Colors.blue | |
: Colors.white), | |
), | |
), | |
), | |
), | |
onTap: () { | |
setState(() { | |
option = Options.stats; | |
}); | |
}, | |
), | |
), | |
Padding( | |
padding: const EdgeInsets.all(4.0), | |
child: InkWell( | |
child: Container( | |
decoration: BoxDecoration( | |
color: option == Options.editProfile | |
? Colors.white | |
: Colors.transparent, | |
borderRadius: BorderRadius.only( | |
topRight: Radius.circular(10), | |
bottomRight: Radius.circular(10))), | |
child: Center( | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Text( | |
"Edit Profile", | |
style: TextStyle( | |
color: option == Options.editProfile | |
? Colors.blue | |
: Colors.white), | |
), | |
), | |
), | |
), | |
onTap: () { | |
setState(() { | |
option = Options.editProfile; | |
}); | |
}, | |
), | |
), | |
], | |
), | |
), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment