@@ -13,6 +13,7 @@ class MyApp extends StatefulWidget {
1313class _MyAppState extends State <MyApp > {
1414 String action = 'No Action' ;
1515 final FlutterShortcuts flutterShortcuts = FlutterShortcuts ();
16+ int maxLimit;
1617
1718 @override
1819 void initState () {
@@ -52,15 +53,18 @@ class _MyAppState extends State<MyApp> {
5253 ),
5354 ),
5455 ),
55- Text ("Flutter Shortcuts Max Limit" ),
56+ Text (
57+ "Flutter Shortcuts Max Limit -> ${maxLimit == null ? '' : maxLimit }" ),
5658 Row (
5759 children: [
5860 ElevatedButton (
5961 child: Text ("Get Max Shortcut Limit" ),
6062 onPressed: () async {
6163 int result =
6264 await flutterShortcuts.getMaxShortcutLimit ();
63- print ("======> max: $result " );
65+ setState (() {
66+ maxLimit = result;
67+ });
6468 },
6569 ),
6670 ],
@@ -77,14 +81,14 @@ class _MyAppState extends State<MyApp> {
7781 shortcutItems: < FlutterShortcutItem > [
7882 const FlutterShortcutItem (
7983 id: "1" ,
80- action: 'Homepage ' ,
81- shortLabel: 'Play Ludo ' ,
84+ action: 'Home page action ' ,
85+ shortLabel: 'Home Page ' ,
8286 icon: 'ic_launcher' ,
8387 ),
8488 const FlutterShortcutItem (
8589 id: "2" ,
86- action: 'Secondpage ' ,
87- shortLabel: 'Play Snake Ladder ' ,
90+ action: 'Second page action ' ,
91+ shortLabel: 'Second Page ' ,
8892 icon: 'ic_launcher' ,
8993 ),
9094 ],
@@ -115,9 +119,9 @@ class _MyAppState extends State<MyApp> {
115119 onPressed: () async {
116120 await flutterShortcuts.pushShortcutItem (
117121 shortcut: FlutterShortcutItem (
118- id: "2 " ,
119- action: "fifthaction " ,
120- shortLabel: "shortLabel " ,
122+ id: "5 " ,
123+ action: "Fifth action " ,
124+ shortLabel: "Shortcut 5 " ,
121125 ),
122126 );
123127 },
@@ -129,14 +133,14 @@ class _MyAppState extends State<MyApp> {
129133 shortcutList: < FlutterShortcutItem > [
130134 const FlutterShortcutItem (
131135 id: "1" ,
132- action: 'Homepage ' ,
133- shortLabel: 'Home Page 1 ' ,
136+ action: 'Home page action updated ' ,
137+ shortLabel: 'Home Page updated ' ,
134138 icon: 'ic_launcher' ,
135139 ),
136140 const FlutterShortcutItem (
137141 id: "2" ,
138- action: 'Secondpage ' ,
139- shortLabel: 'Second Page 2 ' ,
142+ action: 'Second page action updated ' ,
143+ shortLabel: 'Second Page updated ' ,
140144 icon: 'ic_launcher' ,
141145 ),
142146 ],
@@ -151,24 +155,24 @@ class _MyAppState extends State<MyApp> {
151155 ElevatedButton (
152156 child: Text ("Add Shortcut" ),
153157 onPressed: () async {
154- await flutterShortcuts.addShortcutItems (
158+ await flutterShortcuts.pushShortcutItems (
155159 shortcutList: < FlutterShortcutItem > [
156160 const FlutterShortcutItem (
157161 id: "1" ,
158- action: 'Homepage ' ,
159- shortLabel: 'Home Page 1 ' ,
162+ action: 'homepage new action ' ,
163+ shortLabel: 'Home Page' ,
160164 icon: 'ic_launcher' ,
161165 ),
162166 const FlutterShortcutItem (
163167 id: "2" ,
164- action: 'Secondpage ' ,
165- shortLabel: 'Second Page 2 ' ,
168+ action: 'second page new action ' ,
169+ shortLabel: 'Second Page' ,
166170 icon: 'ic_launcher' ,
167171 ),
168172 const FlutterShortcutItem (
169173 id: "3" ,
170174 action: 'Thirdpage' ,
171- shortLabel: 'Third Page 3 ' ,
175+ shortLabel: 'Third Page' ,
172176 icon: 'ic_launcher' ,
173177 ),
174178 ]);
@@ -181,8 +185,8 @@ class _MyAppState extends State<MyApp> {
181185 id: "1" ,
182186 shortcut: FlutterShortcutItem (
183187 id: "1" ,
184- action: 'Fourthpage ' ,
185- shortLabel: 'Fourth Page 4 ' ,
188+ action: 'action updated with ID ' ,
189+ shortLabel: 'Homepage ' ,
186190 icon: 'ic_launcher' ,
187191 ),
188192 );
@@ -191,82 +195,22 @@ class _MyAppState extends State<MyApp> {
191195 ],
192196 ),
193197 Divider (),
194- Text ("Long/Short Label" ),
195- Row (
196- mainAxisAlignment: MainAxisAlignment .spaceEvenly,
197- children: [
198- ElevatedButton (
199- child: Text ("Change Short Title" ),
200- onPressed: () {
201- // flutterShortcuts.updateShortcutItemTitle(id, title);
202- },
203- ),
204- ElevatedButton (
205- child: Text ("Change Long Title" ),
206- onPressed: () {
207- // flutterShortcuts.updateShortcutItemTitle(id, title);
208- },
209- ),
210- ],
211- ),
212- Divider (),
213198 Text ("Icons" ),
214199 Row (
215200 mainAxisAlignment: MainAxisAlignment .spaceEvenly,
216201 children: [
217- ElevatedButton (
218- child: Text ("Icon Properties" ),
219- onPressed: () async {
220- Map <String , int > properties =
221- await flutterShortcuts.getIconProperties ();
222- print (properties);
223- },
224- ),
225202 ElevatedButton (
226203 child: Text ("Change icon of 2nd Shortcut" ),
227204 onPressed: () {
228205 flutterShortcuts.changeShortcutItemIcon (
229- id: "2" , icon: "bookmark_icon" );
206+ id: "2" ,
207+ icon: "bookmark_icon" ,
208+ );
230209 },
231210 ),
232211 ],
233212 ),
234213 Divider (),
235- ElevatedButton (
236- child: Text ("change icon color of 2nd Shortcut" ),
237- onPressed: () {
238- // disable title
239- // flutterShortcuts.changeIconColor(id, color);
240- },
241- ),
242- ElevatedButton (
243- child: Text ("change icon backgroud color of 2nd Shortcut" ),
244- onPressed: () {
245- // disable title
246- // flutterShortcuts.changeIconBackgroundColor(id, color);
247- },
248- ),
249- ElevatedButton (
250- child: Text ("set animated icon of 2nd Shortcut" ),
251- onPressed: () {
252- // disable title
253- // flutterShortcuts.setAnimatedIcon(id, AnimatedIcon);
254- },
255- ),
256- ElevatedButton (
257- child: Text ("set icon backgroud gradient of 2nd Shortcut" ),
258- onPressed: () {
259- // disable title
260- // flutterShortcuts.iconBackgroundGradient(id,[start,end], [start color,end color]);
261- },
262- ),
263- ElevatedButton (
264- child: Text ("Toggle disable state of 2nd Shortcut" ),
265- onPressed: () {
266- // disable title
267- // flutterShortcuts.updateDisableStateShortcutItem(id, state(bool), disable title);
268- },
269- ),
270214 ],
271215 ),
272216 ),
0 commit comments