Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views1 page

BTN Dart

The document defines a Flutter app with a stateful widget that contains a toggle switch button. Tapping the button updates the state to toggle a boolean value that controls the button text and status text displayed on the screen. The app uses setState to rebuild the widget when the state changes.

Uploaded by

aliborhanian117
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

BTN Dart

The document defines a Flutter app with a stateful widget that contains a toggle switch button. Tapping the button updates the state to toggle a boolean value that controls the button text and status text displayed on the screen. The app uses setState to rebuild the widget when the state changes.

Uploaded by

aliborhanian117
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

// import 'package:flutter/material.

dart';

// void main() {
// runApp(MyApp());
// }

// class MyApp extends StatelessWidget {


// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// home: MyHomePage(),
// );
// }
// }

// class MyHomePage extends StatefulWidget {


// @override
// _MyHomePageState createState() => _MyHomePageState();
// }

// class _MyHomePageState extends State<MyHomePage> {


// bool isTurnedOn = false;

// void toggleSwitch() {
// setState(() {
// isTurnedOn = !isTurnedOn;
// });
// }

// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: Text('Turn On/Off Button'),
// ),
// body: Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Text(
// isTurnedOn ? 'Turned On' : 'Turned Off',
// style: TextStyle(fontSize: 24),
// ),
// SizedBox(height: 20),
// ElevatedButton(
// onPressed: toggleSwitch,
// child: Text(isTurnedOn ? 'Turn Off' : 'Turn On'),
// ),
// ],
// ),
// ),
// );
// }
// }

You might also like