Created
July 21, 2022 10:39
-
-
Save SiddheshKukade/436224c8dea68e18367515d331c5aa4c to your computer and use it in GitHub Desktop.
Just a demo to show and Hide components
This file contains hidden or 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'; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith( | |
scaffoldBackgroundColor: darkBlue, | |
), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Column( | |
children: [ | |
SizedBox( | |
height: 100, | |
), | |
const Center( | |
child: TalawaPluginProvider( | |
demo: true, | |
child: const Text( | |
"Hello, bro!", | |
style: TextStyle(fontSize: 42), | |
), | |
), | |
), | |
SizedBox( | |
height: 100, | |
), | |
const Center( | |
child: TalawaPluginProvider( | |
demo: true, | |
child: const Text( | |
"Hello, Sir!", | |
style: TextStyle(fontSize: 42), | |
), | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} | |
class TalawaPluginProvider extends StatelessWidget { | |
final Widget? child; | |
final bool demo; | |
const TalawaPluginProvider( | |
{Key? key, @required this.child, required this.demo}) | |
: super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Visibility(visible: demo, child: child!); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment