2021-05-28 06:13:59 -04:00
|
|
|
import 'package:bullseye/game_model.dart';
|
2021-05-28 04:59:28 -04:00
|
|
|
import 'package:flutter/material.dart';
|
2021-05-28 05:34:28 -04:00
|
|
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
2021-05-28 04:59:28 -04:00
|
|
|
|
|
|
|
class Control extends StatefulWidget {
|
2021-05-28 06:13:59 -04:00
|
|
|
Control({Key? key, @required this.model}) : super(key: key);
|
|
|
|
final GameModel? model;
|
2021-05-28 04:59:28 -04:00
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() => _ControlState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ControlState extends State<Control> {
|
2021-05-28 06:13:59 -04:00
|
|
|
static const double PADDING = 45;
|
2021-05-28 04:59:28 -04:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-05-28 06:13:59 -04:00
|
|
|
var currentValue = widget.model?.current;
|
|
|
|
|
2021-05-28 04:59:28 -04:00
|
|
|
return Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
2021-05-28 06:13:59 -04:00
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(PADDING),
|
|
|
|
child: PlatformText("1"),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: PlatformSlider(
|
|
|
|
value: currentValue!.toDouble(),
|
|
|
|
onChanged: (newValue) {
|
|
|
|
setState(() {
|
|
|
|
widget.model!.current = newValue.toInt();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
min: 1.0,
|
|
|
|
max: 100.0,
|
|
|
|
),
|
2021-05-28 04:59:28 -04:00
|
|
|
),
|
2021-05-28 06:13:59 -04:00
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(PADDING),
|
|
|
|
child: PlatformText("100"),
|
|
|
|
)
|
2021-05-28 04:59:28 -04:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|