Created
May 8, 2020 07:26
-
-
Save VB10/0ec9fca4bd246b21276505ae87cd815b 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 'custom_card.dart'; | |
class SwitchView extends StatefulWidget { | |
@override | |
_SwitchViewState createState() => _SwitchViewState(); | |
} | |
class _SwitchViewState extends State<SwitchView> { | |
bool isActiveOnView = false; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: CustomCard( | |
iconData: Icons.access_alarm, | |
isActive: isActiveOnView, | |
text: "Hello", | |
onTap: changeSwitchButton, | |
), | |
), | |
); | |
} | |
void changeSwitchButton() { | |
setState(() { | |
isActiveOnView = !isActiveOnView; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment