You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
|
|
|
import '../app_style/colors.dart';
|
|
import '../app_style/sizing.dart';
|
|
|
|
class ASwitchButton extends StatelessWidget {
|
|
final String title;
|
|
final bool value;
|
|
final void Function(bool) onChange;
|
|
|
|
const ASwitchButton({
|
|
@required this.title,
|
|
@required this.value,
|
|
@required this.onChange,
|
|
Key key,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
margin: const EdgeInsets.symmetric(vertical: 8),
|
|
decoration: BoxDecoration(
|
|
color: AColors.inputFieldBackgroundColor,
|
|
border: Border.all(
|
|
color: const Color(0xffefefef),
|
|
),
|
|
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
ASubTitle(title),
|
|
Switch.adaptive(
|
|
value: value,
|
|
activeColor: AColors.primaryColor,
|
|
onChanged: onChange,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|