1
1
import 'package:flutter/material.dart' ;
2
- import 'dart:async' ;
3
2
4
- import 'package:flutter/services.dart' ;
5
3
import 'package:live_icon/live_icon.dart' ;
6
4
7
5
void main () {
@@ -14,32 +12,21 @@ class MyApp extends StatefulWidget {
14
12
}
15
13
16
14
class _MyAppState extends State <MyApp > {
17
- String _platformVersion = 'Unknown' ;
15
+ LiveIcon liveIcon = LiveIcon () ;
18
16
19
17
@override
20
18
void initState () {
21
19
super .initState ();
22
- initPlatformState ();
23
- }
24
-
25
- // Platform messages are asynchronous, so we initialize in an async method.
26
- Future <void > initPlatformState () async {
27
- String platformVersion;
28
- // Platform messages may fail, so we use a try/catch PlatformException.
29
- try {
30
- platformVersion = await LiveIcon .platformVersion;
31
- } on PlatformException {
32
- platformVersion = 'Failed to get platform version.' ;
33
- }
34
-
35
- // If the widget was removed from the tree while the asynchronous platform
36
- // message was in flight, we want to discard the reply rather than calling
37
- // setState to update our non-existent appearance.
38
- if (! mounted) return ;
39
-
40
- setState (() {
41
- _platformVersion = platformVersion;
42
- });
20
+ liveIcon.initialize (icons: [
21
+ const LiveIconData (
22
+ iconName: "darkTheme" ,
23
+ className: "DarkTheme" ,
24
+ ),
25
+ const LiveIconData (
26
+ iconName: "lightTheme" ,
27
+ className: "LightTheme" ,
28
+ ),
29
+ ]);
43
30
}
44
31
45
32
@override
@@ -50,7 +37,7 @@ class _MyAppState extends State<MyApp> {
50
37
title: const Text ('Plugin example app' ),
51
38
),
52
39
body: Center (
53
- child: Text ('Running on: $ _platformVersion \n ' ),
40
+ child: Text ('' ),
54
41
),
55
42
),
56
43
);
0 commit comments