selfprivacy.org.app/lib/ui/components/switch_block/switch_bloc.dart

39 lines
1.0 KiB
Dart
Raw Normal View History

2020-12-06 09:46:12 +02:00
import 'package:flutter/material.dart';
import 'package:selfprivacy/config/brand_colors.dart';
class SwitcherBlock extends StatelessWidget {
const SwitcherBlock({
2022-06-05 22:36:32 +03:00
super.key,
2021-03-15 17:39:44 +02:00
required this.child,
required this.isActive,
required this.onChange,
2022-06-05 22:36:32 +03:00
});
2020-12-06 09:46:12 +02:00
final Widget child;
final bool isActive;
2020-12-08 21:26:51 +02:00
final ValueChanged<bool> onChange;
2020-12-06 09:46:12 +02:00
@override
2022-06-05 22:36:32 +03:00
Widget build(final BuildContext context) => Container(
2022-05-24 21:55:39 +03:00
padding: const EdgeInsets.only(top: 20, bottom: 5),
decoration: const BoxDecoration(
2020-12-06 09:46:12 +02:00
border: Border(
bottom: BorderSide(width: 1, color: BrandColors.dividerColor),
2022-06-05 22:36:32 +03:00
),),
2020-12-06 09:46:12 +02:00
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: child),
2022-05-24 21:55:39 +03:00
const SizedBox(width: 5),
2020-12-06 09:46:12 +02:00
Switch(
activeColor: BrandColors.green1,
activeTrackColor: BrandColors.green2,
2020-12-08 21:26:51 +02:00
onChanged: onChange,
2020-12-06 09:46:12 +02:00
value: isActive,
),
],
),
);
}