Skip to content

Instantly share code, notes, and snippets.

@VB10
Created May 8, 2020 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VB10/0ec9fca4bd246b21276505ae87cd815b to your computer and use it in GitHub Desktop.
Save VB10/0ec9fca4bd246b21276505ae87cd815b to your computer and use it in GitHub Desktop.
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