Skip to content

Commit 6012753

Browse files
committed
Update readme
1 parent bc56ff4 commit 6012753

2 files changed

Lines changed: 43 additions & 44 deletions

File tree

README.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,39 @@ dependencies:
1717
1818
## Basic Usage:
1919
```dart
20-
return Container(
21-
width: 200,
22-
height: 200,
23-
decoration: DiagonalDecoration(),
20+
YakoThemeSwitch(
21+
enabled: themeMode == ThemeMode.light,
22+
onChanged: ({bool? changed}) {},
2423
);
2524
```
2625
## Advanced usage
2726
```dart
28-
decoration: const DiagonalDecoration(
29-
lineColor: Colors.black,
30-
backgroundColor: Colors.grey,
31-
radius: Radius.circular(20),
32-
lineWidth: 1,
33-
distanceBetweenLines: 5,
34-
)
27+
YakoThemeSwitch(
28+
enabled: themeMode == ThemeMode.light,
29+
onChanged: ({bool? changed}) {},
30+
width: 50,
31+
enabledBackgroundColor: Colors.blue,
32+
disabledBackgroundColor: Colors.red,
33+
enabledToggleColor: Colors.white,
34+
disabledToggleColor: Colors.white,
35+
animationDuration: const Duration(milliseconds: 300),
36+
enabledToggleBorderRadius: 8,
37+
),
3538
```
3639

3740
<br>
3841

3942

40-
Check out other Yako packages:
41-
[Badges](https://pub.dev/packages/badges),
42-
[Settings UI](https://pub.dev/packages/settings_ui),
43-
[Status Alert](https://pub.dev/packages/status_alert),
44-
[Full Screen Menu](https://pub.dev/packages/full_screen_menu) and more to come!
43+
## Check out other Yako packages:
44+
45+
[Badges](https://pub.dev/packages/badges)
46+
47+
[Settings UI](https://pub.dev/packages/settings_ui)
48+
49+
[Status Alert](https://pub.dev/packages/status_alert)
50+
51+
[Full Screen Menu](https://pub.dev/packages/full_screen_menu)
52+
53+
[Diagonal decoration](https://pub.dev/packages/diagonal_decoration)
54+
55+
and more to come!

example/lib/main.dart

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,22 @@ class _MainAppState extends State<MainApp> {
2020
return MaterialApp(
2121
darkTheme: ThemeData(scaffoldBackgroundColor: Colors.black),
2222
themeMode: themeMode,
23-
home: GestureDetector(
24-
onTap: () {
25-
setState(() {
26-
themeMode =
27-
themeMode == ThemeMode.light ? ThemeMode.dark : ThemeMode.light;
28-
});
29-
},
30-
child: Scaffold(
31-
body: Center(
32-
child: Row(
33-
mainAxisAlignment: MainAxisAlignment.center,
34-
children: [
35-
Transform.scale(
36-
scale: 4,
37-
child: YakoThemeSwitch(
38-
enabled: themeMode == ThemeMode.light,
39-
onChanged: ({bool? changed}) {
40-
if (changed != null) {
41-
setState(() {
42-
themeMode =
43-
changed ? ThemeMode.light : ThemeMode.dark;
44-
});
45-
}
46-
},
47-
),
48-
),
49-
],
50-
),
23+
home: Scaffold(
24+
body: Center(
25+
child: Row(
26+
mainAxisAlignment: MainAxisAlignment.center,
27+
children: [
28+
YakoThemeSwitch(
29+
enabled: themeMode == ThemeMode.light,
30+
onChanged: ({bool? changed}) {
31+
if (changed != null) {
32+
setState(() {
33+
themeMode = changed ? ThemeMode.light : ThemeMode.dark;
34+
});
35+
}
36+
},
37+
),
38+
],
5139
),
5240
),
5341
),

0 commit comments

Comments
 (0)