forked from qwertypool/flutter-code-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
responsivenessCheck.dart
61 lines (49 loc) · 1.69 KB
/
responsivenessCheck.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Add this dependency-->>
device_preview: ^0.7.4
import 'dart:io';
import 'package:device_preview/device_preview.dart';
import 'package:device_preview/plugins.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as path;
import 'basic.dart';
void main() {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
WidgetsFlutterBinding.ensureInitialized();
_createFakeData();
runApp(Row(
textDirection: TextDirection.ltr,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
/*Expanded(
child: Container(color: Colors.red),
),*/
Expanded(
child: DevicePreview(
enabled: true,
plugins: [
const ScreenshotPlugin(),
const FileExplorerPlugin(),
const SharedPreferencesExplorerPlugin(),
],
builder: (context) => BasicApp(),
),
),
],
));
}
Future<void> _createFakeData() async {
final directory = (await getApplicationDocumentsDirectory()).path;
final file1 = File(path.join(directory, 'example.json'));
await file1.writeAsString('{ "example": true}');
final directoryWithFile = Directory(path.join(directory, 'subdir'));
await directoryWithFile.create();
final emptyDirectory = Directory(path.join(directory, 'emptyDir'));
await emptyDirectory.create();
final file2 = File(path.join(directoryWithFile.path, 'example2.json'));
await file2.writeAsString('{ "example2": true}');
final file3 = File(path.join(directoryWithFile.path, 'example2.bin'));
await file3.writeAsString('kjh8bhb');
}