Add Material 3 SwitchListTile example and update existing examples (#119714)
* Add Material 3 `SwitchListTile` example and update existing examples * Update examples with `useMaterial3: true` and update example descriptions. * add a `ColorScheme` colour
This commit is contained in:
@@ -14,8 +14,9 @@ class CheckboxListTileApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: CheckboxListTileExample(),
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const CheckboxListTileExample(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class CheckboxListTileApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const CheckboxListTileExample(),
|
||||
);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class _CheckboxListTileExampleState extends State<CheckboxListTileExample> {
|
||||
setState(() {
|
||||
checkboxValue1 = value!;
|
||||
});
|
||||
},
|
||||
},
|
||||
title: const Text('Headline'),
|
||||
subtitle: const Text('Supporting text'),
|
||||
),
|
||||
@@ -55,7 +55,7 @@ class _CheckboxListTileExampleState extends State<CheckboxListTileExample> {
|
||||
setState(() {
|
||||
checkboxValue2 = value!;
|
||||
});
|
||||
},
|
||||
},
|
||||
title: const Text('Headline'),
|
||||
subtitle: const Text('Longer supporting text to demonstrate how the text wraps and the checkbox is centered vertically with the text.'),
|
||||
),
|
||||
@@ -66,7 +66,7 @@ class _CheckboxListTileExampleState extends State<CheckboxListTileExample> {
|
||||
setState(() {
|
||||
checkboxValue3 = value!;
|
||||
});
|
||||
},
|
||||
},
|
||||
title: const Text('Headline'),
|
||||
subtitle: const Text("Longer supporting text to demonstrate how the text wraps and how setting 'CheckboxListTile.isThreeLine = true' aligns the checkbox to the top vertically with the text."),
|
||||
isThreeLine: true,
|
||||
|
||||
@@ -8,15 +8,16 @@ import 'package:flutter/gestures.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const LabeledCheckBoxApp());
|
||||
void main() => runApp(const LabeledCheckboxApp());
|
||||
|
||||
class LabeledCheckBoxApp extends StatelessWidget {
|
||||
const LabeledCheckBoxApp({super.key});
|
||||
class LabeledCheckboxApp extends StatelessWidget {
|
||||
const LabeledCheckboxApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: LabeledCheckBoxExample(),
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const LabeledCheckboxExample(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -68,14 +69,14 @@ class LinkedLabelCheckbox extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class LabeledCheckBoxExample extends StatefulWidget {
|
||||
const LabeledCheckBoxExample({super.key});
|
||||
class LabeledCheckboxExample extends StatefulWidget {
|
||||
const LabeledCheckboxExample({super.key});
|
||||
|
||||
@override
|
||||
State<LabeledCheckBoxExample> createState() => _LabeledCheckBoxExampleState();
|
||||
State<LabeledCheckboxExample> createState() => _LabeledCheckboxExampleState();
|
||||
}
|
||||
|
||||
class _LabeledCheckBoxExampleState extends State<LabeledCheckBoxExample> {
|
||||
class _LabeledCheckboxExampleState extends State<LabeledCheckboxExample> {
|
||||
bool _isSelected = false;
|
||||
|
||||
@override
|
||||
|
||||
@@ -6,15 +6,16 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const LabeledCheckBoxApp());
|
||||
void main() => runApp(const LabeledCheckboxApp());
|
||||
|
||||
class LabeledCheckBoxApp extends StatelessWidget {
|
||||
const LabeledCheckBoxApp({super.key});
|
||||
class LabeledCheckboxApp extends StatelessWidget {
|
||||
const LabeledCheckboxApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: LabeledCheckBoxExample(),
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const LabeledCheckboxExample(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -57,14 +58,14 @@ class LabeledCheckbox extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class LabeledCheckBoxExample extends StatefulWidget {
|
||||
const LabeledCheckBoxExample({super.key});
|
||||
class LabeledCheckboxExample extends StatefulWidget {
|
||||
const LabeledCheckboxExample({super.key});
|
||||
|
||||
@override
|
||||
State<LabeledCheckBoxExample> createState() => _LabeledCheckBoxExampleState();
|
||||
State<LabeledCheckboxExample> createState() => _LabeledCheckboxExampleState();
|
||||
}
|
||||
|
||||
class _LabeledCheckBoxExampleState extends State<LabeledCheckBoxExample> {
|
||||
class _LabeledCheckboxExampleState extends State<LabeledCheckboxExample> {
|
||||
bool _isSelected = false;
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user