2 |
3 |
7 |
8 | Create samples of you widgets and preview them in real time
9 |
10 |
11 |
12 |
13 |
27 |
28 | - Open a dart file in vscode and the preview button will appear
29 |
30 | - Click the button to launch Flutter Preview
31 |
32 | ### Adding a preview
33 |
34 | A vscode snippet is availabe for creating a preview, just type `preview` and it will appear.
35 |
36 | - Create a new class that extends `PreviewProvider`
37 |
38 | ```dart
39 |
40 | class MyPreview extends PreviewProvider {
41 |
42 | List| 135 | 136 | ```dart 137 | class DevicePreviewProvider extends StatelessWidget with Previewer { 138 | @override 139 | String get title => 'Device Preview'; 140 | 141 | @override 142 | Widget build(BuildContext context) { 143 | return DevicePreview( 144 | builder: (context) => MyApp(), 145 | ); 146 | } 147 | } 148 | ``` 149 | 150 | 151 | | 152 | 153 | |
154 |
2 |
3 |
7 |
8 | Create samples of you widgets and preview them in real time
9 |
10 |
11 |
12 |
13 |
27 |
28 | - Open a dart file in vscode and the preview button will appear
29 |
30 | - Click the button to launch Flutter Preview
31 |
32 | ### Adding a preview
33 |
34 | A vscode snippet is availabe for creating a preview, just type `preview` and it will appear.
35 |
36 | - Create a new class that extends `PreviewProvider`
37 |
38 | ```dart
39 |
40 | class MyPreview extends PreviewProvider {
41 |
42 | List| 135 | 136 | ```dart 137 | class DevicePreviewProvider extends StatelessWidget with Previewer { 138 | @override 139 | String get title => 'Device Preview'; 140 | 141 | @override 142 | Widget build(BuildContext context) { 143 | return DevicePreview( 144 | builder: (context) => MyApp(), 145 | ); 146 | } 147 | } 148 | ``` 149 | 150 | 151 | | 152 | 153 | |
154 |