Added prompt and control widgets

- Updated iOS portion of project
- Always to default landscape
This commit is contained in:
Tony Bark 2021-05-28 04:59:28 -04:00
parent 90dafce466
commit 9e475f6a34
20 changed files with 328 additions and 7 deletions

34
lib/control.dart Normal file
View file

@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
class Control extends StatefulWidget {
Control({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => _ControlState();
}
class _ControlState extends State<Control> {
double _currentValue = 50.0;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("1"),
Slider(
value: _currentValue,
onChanged: (newValue) {
setState(() {
_currentValue = newValue;
print(_currentValue);
});
},
min: 1.0,
max: 100.0,
),
Text("100")
],
);
}
}

View file

@ -1,4 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:bullseye/prompt.dart';
import 'package:bullseye/control.dart';
void main() => runApp(BullsEyeApp());
@ -6,6 +9,8 @@ class BullsEyeApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
return MaterialApp(
title: 'BullsEye',
theme: ThemeData(
@ -34,9 +39,8 @@ class _GamePageState extends State<GamePage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Hello World!",
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.green)),
Prompt(targetValue: 100),
Control(),
TextButton(
child: Text('Hit me!'),
onPressed: () {

17
lib/prompt.dart Normal file
View file

@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
class Prompt extends StatelessWidget {
Prompt({@required this.targetValue});
final int? targetValue;
@override
Widget build(BuildContext context) {
// TODO: implement build
return Column(
children: <Widget>[
Text("PUT THE BULLSEYE AS CLOSE YOU CAN TO"),
Text("$targetValue")
],
);
}
}