|
| 1 | +import 'dart:convert'; |
| 2 | +import 'dart:math'; |
| 3 | + |
1 | 4 | import 'package:flutter/material.dart'; |
2 | 5 |
|
3 | 6 | import 'package:app_widget/app_widget.dart'; |
@@ -124,12 +127,14 @@ class UpdateWidgetButton extends StatelessWidget { |
124 | 127 |
|
125 | 128 | // send configure |
126 | 129 | await _appWidgetPlugin.updateWidget( |
127 | | - widgetId: widgetId, |
128 | | - widgetLayout: 'example_layout', |
129 | | - textViews: { |
130 | | - 'widget_title': 'App Widget', |
131 | | - 'widget_message': 'Updated in flutter' |
132 | | - }); |
| 130 | + widgetId: widgetId, |
| 131 | + widgetLayout: 'example_layout', |
| 132 | + textViews: { |
| 133 | + 'widget_title': 'App Widget', |
| 134 | + 'widget_message': 'Updated in flutter' |
| 135 | + }, |
| 136 | + payload: jsonEncode({'number': Random.secure().nextInt(10)}), |
| 137 | + ); |
133 | 138 | } |
134 | 139 | }, |
135 | 140 | child: const Text('Update Widget'), |
@@ -254,12 +259,14 @@ class ConfigureButton extends StatelessWidget { |
254 | 259 |
|
255 | 260 | // send configure |
256 | 261 | await _appWidgetPlugin.configureWidget( |
257 | | - widgetId: _widgetId!, |
258 | | - widgetLayout: 'example_layout', |
259 | | - textViews: { |
260 | | - 'widget_title': 'App Widget', |
261 | | - 'widget_message': 'Configured in flutter' |
262 | | - }); |
| 262 | + widgetId: _widgetId!, |
| 263 | + widgetLayout: 'example_layout', |
| 264 | + textViews: { |
| 265 | + 'widget_title': 'App Widget', |
| 266 | + 'widget_message': 'Configured in flutter' |
| 267 | + }, |
| 268 | + payload: jsonEncode({'number': Random().nextInt(10)}), |
| 269 | + ); |
263 | 270 | messenger.showSnackBar( |
264 | 271 | const SnackBar(content: Text('Widget has been configured!'))); |
265 | 272 | } else { |
|
0 commit comments