forked from eatvio/eatvio_app
49 lines
1.1 KiB
Dart
49 lines
1.1 KiB
Dart
import 'package:eatvio_app/theme/theme_helper.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class NotificationSwitch extends StatefulWidget {
|
|
final String title;
|
|
|
|
NotificationSwitch(this.title);
|
|
|
|
@override
|
|
_NotificationSwitchState createState() => _NotificationSwitchState();
|
|
}
|
|
|
|
class _NotificationSwitchState extends State<NotificationSwitch> {
|
|
bool switchValue = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
widget.title,
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Switch(
|
|
value: switchValue,
|
|
onChanged: toggleSwitch(),
|
|
inactiveThumbColor: appTheme.blueA400,
|
|
inactiveTrackColor: Colors.white,
|
|
activeTrackColor: appTheme.blueA400,
|
|
activeColor: Colors.white,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
toggleSwitch() {
|
|
return (value) {
|
|
setState(() {
|
|
switchValue = value;
|
|
});
|
|
};
|
|
}
|
|
}
|