Files
2024-11-13 19:18:27 +01:00

130 lines
4.1 KiB
Dart

import 'package:flutter/material.dart';
// ignore: must_be_immutable
class MovieDetailsSettingsStateBox extends StatefulWidget {
MovieDetailsSettingsStateBox({
super.key,
required this.state,
required this.stateChanged,
});
int state;
final Function(int state) stateChanged;
@override
State<MovieDetailsSettingsStateBox> createState() =>
_MovieDetailsSettingsStateBoxState();
}
class _MovieDetailsSettingsStateBoxState
extends State<MovieDetailsSettingsStateBox> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
child: Column(
children: [
const Text(
'State',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
Container(
decoration: BoxDecoration(
// color: BoxColor.backgroundColor,
border: Border.all(color: Colors.grey),
borderRadius: const BorderRadius.all(
Radius.circular(5.0),
),
),
child: SizedBox(
height: 55,
child: Row(
children: [
SizedBox(
width: 180,
child: CheckboxListTile(
side: WidgetStateBorderSide.resolveWith(
(states) =>
const BorderSide(width: 1.0, color: Colors.grey),
),
title: const Text(
'initialized',
textAlign: TextAlign.end,
style: TextStyle(color: Colors.black),
),
value: widget.state == 1,
onChanged: (bool? value) {
if (value == true) {
setState(() {
widget.state = 1;
widget.stateChanged(1);
});
}
},
),
),
SizedBox(
width: 180,
child: CheckboxListTile(
side: WidgetStateBorderSide.resolveWith(
(states) =>
const BorderSide(width: 1.0, color: Colors.grey),
),
title: const Text(
'in progress',
textAlign: TextAlign.end,
style: TextStyle(color: Colors.black),
),
value: widget.state == 2,
onChanged: (bool? value) {
if (value == true) {
setState(() {
widget.state = 2;
widget.stateChanged(2);
});
}
},
),
),
SizedBox(
width: 130,
child: CheckboxListTile(
side: WidgetStateBorderSide.resolveWith(
(states) =>
const BorderSide(width: 1.0, color: Colors.grey),
),
title: const Text(
'done',
textAlign: TextAlign.end,
style: TextStyle(color: Colors.black),
),
value: widget.state == 3,
onChanged: (bool? value) {
if (value == true) {
setState(() {
widget.state = 3;
widget.stateChanged(3);
});
}
},
),
),
],
),
),
),
],
),
);
}
}