From 9b8fa1f1b7fe96a8dc09a84af093bced8cd44257 Mon Sep 17 00:00:00 2001 From: BaoBui Date: Wed, 17 May 2023 16:58:57 +0700 Subject: [PATCH] - --- .../lib/src/screens/switch/switch_screen.dart | 59 ++++++++----------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/example/lib/src/screens/switch/switch_screen.dart b/example/lib/src/screens/switch/switch_screen.dart index 1a33dbb..9f9aecd 100644 --- a/example/lib/src/screens/switch/switch_screen.dart +++ b/example/lib/src/screens/switch/switch_screen.dart @@ -28,7 +28,7 @@ class _SwitchScreenState extends State { 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(), @@ -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, @@ -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)), ], ), ], @@ -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) { @@ -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, @@ -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)), ], ), ],