selfprivacy.org.app/lib/ui/components/switch_block/switch_bloc.dart
NaiJi 2ac8e4366b Linting!
Co-authored-by: Inex Code <inex.code@selfprivacy.org>
2022-06-06 01:40:34 +03:00

40 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:selfprivacy/config/brand_colors.dart';
class SwitcherBlock extends StatelessWidget {
const SwitcherBlock({
required this.child,
required this.isActive,
required this.onChange,
final super.key,
});
final Widget child;
final bool isActive;
final ValueChanged<bool> onChange;
@override
Widget build(final BuildContext context) => Container(
padding: const EdgeInsets.only(top: 20, bottom: 5),
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(width: 1, color: BrandColors.dividerColor),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: child),
const SizedBox(width: 5),
Switch(
activeColor: BrandColors.green1,
activeTrackColor: BrandColors.green2,
onChanged: onChange,
value: isActive,
),
],
),
);
}