-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswitches.dart
48 lines (44 loc) · 1.4 KB
/
switches.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
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:platty/src/widgets/material_patcher.dart';
import 'package:platty/src/widgets/platform.dart';
class PSwitch extends PlatformAdaptingWidget {
final bool value;
final ValueChanged<bool> onChanged;
final Color activeColor;
final Color androidActiveTrackColor;
final Color androidInactiveTrackColor;
final Color androidInactiveThumbColor;
PSwitch(
{Key key,
@required this.value,
@required this.onChanged,
this.activeColor,
this.androidActiveTrackColor,
this.androidInactiveThumbColor,
this.androidInactiveTrackColor,
TargetPlatform renderPlatform})
: super(key: key, renderPlatform: renderPlatform);
@override
get renderMaterial => (BuildContext context) {
return Switch(
value: value,
onChanged: onChanged,
activeColor: activeColor,
activeTrackColor: androidActiveTrackColor,
inactiveTrackColor: androidInactiveTrackColor,
inactiveThumbColor: androidInactiveThumbColor,
);
};
@override
get renderCupertino => (BuildContext context) {
return MaterialPatcher(
child: CupertinoSwitch(
value: value,
onChanged: onChanged,
activeColor: activeColor,
),
);
};
}