Skip to content

Instantly share code, notes, and snippets.

@gabrielgatu
Created November 20, 2021 18:11
Show Gist options
  • Save gabrielgatu/d5e54d4c9630344a7d83e33044a261d6 to your computer and use it in GitHub Desktop.
Save gabrielgatu/d5e54d4c9630344a7d83e33044a261d6 to your computer and use it in GitHub Desktop.
Flutter2Start - Switch #flutter2start
// ignore_for_file: use_key_in_widget_constructors, prefer_const_constructors, prefer_const_literals_to_create_immutables
import 'package:flutter/material.dart';
void main() {
runApp(App());
}
class App extends StatefulWidget {
@override
_AppState createState() => _AppState();
}
class _AppState extends State<App> {
bool termsAndConditionsAccepted = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Futter2Start"),
centerTitle: true,
),
body: Center(
child: body(),
),
),
);
}
Widget body() => SwitchListTile(
value: termsAndConditionsAccepted,
title: Text("Accetta termini e condizioni d'uso"),
onChanged: (value) => setState(() => termsAndConditionsAccepted = value),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment