forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoggle_section_widget.dart
More file actions
73 lines (70 loc) · 2.38 KB
/
Copy pathtoggle_section_widget.dart
File metadata and controls
73 lines (70 loc) · 2.38 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import 'package:flutter/material.dart';
class ToggleSectionWidget extends StatefulWidget {
final bool isSectionEnabled;
final String sectionTitle;
final String sectionDescription;
final List<Widget> options;
final Function(bool) onSectionEnabledChanged;
const ToggleSectionWidget({
super.key,
required this.isSectionEnabled,
required this.sectionTitle,
required this.sectionDescription,
required this.options,
required this.onSectionEnabledChanged,
});
@override
State<ToggleSectionWidget> createState() => _ToggleSectionWidgetState();
}
class _ToggleSectionWidgetState extends State<ToggleSectionWidget> {
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: const Color(0xFF1A1A1A),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: const Color(0xFF2C2C2E), width: 1),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.sectionTitle,
style: const TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w600),
),
const SizedBox(height: 4),
Text(widget.sectionDescription, style: const TextStyle(color: Color(0xFF8E8E93), fontSize: 13)),
],
),
),
Switch(
value: widget.isSectionEnabled,
onChanged: widget.onSectionEnabledChanged,
activeThumbColor: const Color(0xFF8B5CF6),
),
],
),
if (widget.isSectionEnabled)
Padding(
padding: const EdgeInsets.only(top: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: widget.options,
),
),
],
),
);
}
}