bullseye/lib/control.dart
Tony Bark cacbfc5fda Massive overhaul
- The project was restarted using Android Studio.
- Adoptive platform-specific widgets has been removed due to build issues with Android.
- Dual-licensed under the BSD-3-Clause license and UNLICENSE.
2022-09-05 13:56:05 -04:00

45 lines
1.1 KiB
Dart

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