-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathadaptive_controls.dart
More file actions
49 lines (42 loc) · 1.37 KB
/
adaptive_controls.dart
File metadata and controls
49 lines (42 loc) · 1.37 KB
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
import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
enum ControlsType { cupertino, material, materialDesktop, adaptive }
class AdaptiveControls extends StatelessWidget {
const AdaptiveControls({
Key? key,
required this.controlsType,
}) : super(key: key);
final ControlsType controlsType;
@override
Widget build(BuildContext context) {
switch (controlsType) {
case ControlsType.cupertino:
return const CupertinoControls(
backgroundColor: Color.fromRGBO(41, 41, 41, 0.7),
iconColor: Color.fromARGB(255, 200, 200, 200),
);
case ControlsType.material:
return const MaterialControls();
case ControlsType.materialDesktop:
return const MaterialDesktopControls();
case ControlsType.adaptive:
break;
}
switch (Theme.of(context).platform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
return const MaterialControls();
case TargetPlatform.macOS:
case TargetPlatform.windows:
case TargetPlatform.linux:
return const MaterialDesktopControls();
case TargetPlatform.iOS:
return const CupertinoControls(
backgroundColor: Color.fromRGBO(41, 41, 41, 0.7),
iconColor: Color.fromARGB(255, 200, 200, 200),
);
default:
return const MaterialControls();
}
}
}