Create a Torch Flashlight Application for Android/Ios with FLutter Dart

This Article is posted by theindianappguy at 11/8/2019 2:30:21 PM

color: rgba(0, 0, 0, 0.84); font-family: medium-content-serif-font, Georgia, Cambria, "Times New Roman", Times, serif; font-size: 21px; letter-spacing: -0.084px;](In this tutorial, you are going to learn how to create a Torch Flashlight application for Android And Ios with Flutter on Android Studio. color: rgba(0, 0, 0, 0.84); font-family: medium-content-sans-serif-font, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Arial, sans-serif; font-size: 26px; font-weight: 600; letter-spacing: -0.022em;]( color: rgba(0, 0, 0, 0.84); font-family: medium-content-sans-serif-font, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Arial, sans-serif; font-size: 26px; font-weight: 600; letter-spacing: -0.022em;](Creating the User InterfaceI will just be adding Text with Gesture Detector when the user clicks on it we will turn on light if not already and turn off if it is on, for this we are using Torch Flutter Plugin: [https://pub.dev/packages/torchfont-size: 1rem;]()[https://pub.dev/packages/torch]()[https://pub.dev/packages/torch]()[https://pub.dev/packages/torch](https://pub.dev/packages/torch) PS : not tested on IOS device Here is the code : font-size: 1rem;]( --> pubspec.yaml (font-size: 1rem;](adding torch plugin) -- > main.dart runApp(color:#2196f3;](MaterialApp( color:#808080;font-style:italic;](//initialRoute: '/main', color:#808080;font-style:italic;]( routes: { color:#008000;font-weight:bold;]('/': (context) => color:#2196f3;](Home(), }, )); Home.dart color:#2196f3;](_HomeState(); } color:#000080;font-weight:bold;](class _HomeState color:#000080;font-weight:bold;](extends State { bool color:#660e7a;font-weight:bold;](_isVisible = color:#000080;font-weight:bold;](true; color:#000080;font-weight:bold;](void showToast() { setState(() { color:#660e7a;font-weight:bold;](_isVisible = !color:#660e7a;font-weight:bold;](_isVisible; }); } color:#808000;](@override color:#808000;]( Widget build(BuildContext context) { color:#000080;font-weight:bold;](return color:#2196f3;](Scaffold( body: color:#2196f3;](Container( child: color:#2196f3;](Center( child: color:#2196f3;](Column( mainAxisAlignment: MainAxisAlignment.color:#660e7a;font-weight:bold;](center, children: [ color:#2196f3;](GestureDetector( onTap: (){ color:#000080;font-weight:bold;](if(color:#660e7a;font-weight:bold;](_isVisible){ color:#660e7a;font-weight:bold;](_isVisible = !color:#660e7a;font-weight:bold;](_isVisible; showToast; Torch.font-style:italic;](turnOn(); }color:#000080;font-weight:bold;](else{ color:#660e7a;font-weight:bold;](_isVisible = !color:#660e7a;font-weight:bold;](_isVisible; showToast; Torch.font-style:italic;](turnOff(); } }, child: color:#2196f3;](Visibility( child: color:#2196f3;](Text( color:#008000;font-weight:bold;]('Turn On/Off', style: color:#2196f3;](TextStyle(fontSize: color:#0000ff;](16.0, backgroundColor: Colors.color:#660e7a;font-style:italic;](black, color: Colors.color:#660e7a;font-style:italic;](white), ), ), ), ], ), ), ), ); } }

Tags: flutter, flutter flashlight app, Create a Torch Flashlight Application for Android with Flutter



0 Comments
Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.




© 2018 - Fluttercentral | Email to me - Seven.srikanth@gmail.com