Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
quocbao238 committed May 17, 2023
1 parent 4ec63d9 commit 9b8fa1f
Showing 1 changed file with 26 additions and 33 deletions.
59 changes: 26 additions & 33 deletions example/lib/src/screens/switch/switch_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class _SwitchScreenState extends State<SwitchScreen> {
Widget _body() => ListView(
shrinkWrap: true,
children: const [
M3Switchs(normalIcon: Icons.close, selectedIcon: Icons.check),
LstSwitch(normalIcon: Icons.close, selectedIcon: Icons.check),
M3Space.medium(),
M3SwitchPrimary(normalIcon: Icons.close, selectedIcon: Icons.check),
M3Space.medium(),
Expand Down Expand Up @@ -210,10 +210,9 @@ class M3SwitchAdaptive extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
children: [
const M3Padding(
padding: M3EdgeInsets.only(bottom: M3Spacing.medium),
child: M3Text.titleLarge(
text: 'M3 Switch Adaptive', fontWeight: FontWeight.bold),
),
padding: M3EdgeInsets.only(bottom: M3Spacing.medium),
child: M3Text.titleLarge(
text: 'M3 Switch Adaptive', fontWeight: FontWeight.bold)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
Expand All @@ -225,8 +224,7 @@ class M3SwitchAdaptive extends StatelessWidget {
Expanded(
child: M3Switch.adaptive(value: true, onChanged: (v) {})),
const Expanded(
child: M3Switch.adaptive(value: true, onChanged: null),
),
child: M3Switch.adaptive(value: true, onChanged: null)),
],
),
],
Expand All @@ -235,11 +233,11 @@ class M3SwitchAdaptive extends StatelessWidget {
}
}

class M3Switchs extends StatelessWidget {
class LstSwitch extends StatelessWidget {
final IconData? normalIcon;
final IconData? selectedIcon;

const M3Switchs({super.key, this.normalIcon, this.selectedIcon});
const LstSwitch({super.key, this.normalIcon, this.selectedIcon});

@override
Widget build(BuildContext context) {
Expand All @@ -249,10 +247,9 @@ class M3Switchs extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
children: [
const M3Padding(
padding: M3EdgeInsets.only(bottom: M3Spacing.medium),
child: M3Text.titleLarge(
text: 'M3 Switch', fontWeight: FontWeight.bold),
),
padding: M3EdgeInsets.only(bottom: M3Spacing.medium),
child: M3Text.titleLarge(
text: 'M3 Switch', fontWeight: FontWeight.bold)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
Expand All @@ -274,32 +271,28 @@ class M3Switchs extends StatelessWidget {
children: [
Expanded(
child: M3Switch(
value: false,
onChanged: (v) {},
normalIcon: normalIcon,
selectedIcon: selectedIcon,
)),
value: false,
onChanged: (v) {},
normalIcon: normalIcon,
selectedIcon: selectedIcon)),
Expanded(
child: M3Switch(
value: false,
onChanged: null,
normalIcon: normalIcon,
selectedIcon: selectedIcon,
)),
value: false,
onChanged: null,
normalIcon: normalIcon,
selectedIcon: selectedIcon)),
Expanded(
child: M3Switch(
value: true,
onChanged: (v) {},
normalIcon: normalIcon,
selectedIcon: selectedIcon,
)),
value: true,
onChanged: (v) {},
normalIcon: normalIcon,
selectedIcon: selectedIcon)),
Expanded(
child: M3Switch(
value: true,
onChanged: null,
normalIcon: normalIcon,
selectedIcon: selectedIcon,
)),
value: true,
onChanged: null,
normalIcon: normalIcon,
selectedIcon: selectedIcon)),
],
),
],
Expand Down

0 comments on commit 9b8fa1f

Please sign in to comment.