finished initial setup of 'primary' info of a new pizza event

This commit is contained in:
broodjeaap89 2021-07-08 21:29:43 +02:00
parent c43a4b7264
commit c1f1e4e78a
2 changed files with 82 additions and 57 deletions

View file

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:numberpicker/numberpicker.dart'; import 'package:flutter/services.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
class AddPlannedPizzaPage extends StatefulWidget { class AddPlannedPizzaPage extends StatefulWidget {
@override @override
@ -11,7 +12,7 @@ class AddPlannedPizzaPageState extends State<AddPlannedPizzaPage> {
String name = ""; String name = "";
String pizzaType = "Neapolitan"; String pizzaType = "Neapolitan";
int pizzaCount = 1; int pizzaCount = 1;
int doughballSize = 200; int doughBallSize = 250;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -22,66 +23,89 @@ class AddPlannedPizzaPageState extends State<AddPlannedPizzaPage> {
padding: EdgeInsets.fromLTRB(40, 10, 40, 10), padding: EdgeInsets.fromLTRB(40, 10, 40, 10),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
TextField( Row(
decoration: InputDecoration(
hintText: "Event Name"
),
onChanged: (String newName) {
setState(() {
name = newName;
});
},
),
DropdownButton<String>(
icon: const Icon(Icons.arrow_downward),
value: pizzaType,
isExpanded: true,
onChanged: (String? newType) {
setState(() => pizzaType = newType!);
},
items: <String>["Neapolitan", "New York", "Chicago"]
.map<DropdownMenuItem<String>>((String v) {
return DropdownMenuItem(
value: v,
child: Text(v)
);
}).toList()
),
Column(
children: <Widget>[ children: <Widget>[
Text("# Of Pizzas: "), Icon(Icons.title),
NumberPicker( Container(width: 25),
value: pizzaCount, Expanded(
minValue: 1, child: TextField(
maxValue: 1000, decoration: InputDecoration(
itemHeight: 30, hintText: "Event Name"
axis: Axis.horizontal, ),
onChanged: (newPizzaCount) => setState(() => this.pizzaCount = newPizzaCount), onChanged: (String newName) {
decoration: BoxDecoration( setState(() {
borderRadius: BorderRadius.circular(16), name = newName;
border: Border.all(color: Colors.black26), });
},
), ),
) )
] ]
), ),
Column( Row(
children: <Widget>[ children: <Widget>[
Text("Doughball Size: "), Icon(FontAwesome5.pizza_slice),
NumberPicker( Container(width: 25),
value: doughballSize, Expanded(
minValue: 100, child: DropdownButton<String>(
maxValue: 10000, value: pizzaType,
step: 10, onChanged: (String? newType) {
itemHeight: 30, setState(() => pizzaType = newType!);
axis: Axis.horizontal, },
onChanged: (newDoughballSize) => setState(() => this.doughballSize = newDoughballSize), items: <String>["Neapolitan", "New York", "Chicago"]
decoration: BoxDecoration( .map<DropdownMenuItem<String>>((String v) {
borderRadius: BorderRadius.circular(16), return DropdownMenuItem(
border: Border.all(color: Colors.black26), value: v,
), child: Text(v)
) );
] }).toList()
),
)
]
), ),
Row(
children: <Widget>[
Icon(FontAwesome5.hashtag),
Expanded(
child: Slider(
value: pizzaCount.toDouble(),
min: 1,
max: 20,
divisions: 19,
label: this.pizzaCount.toString(),
onChanged: (double newPizzaCount) {
setState(() {this.pizzaCount = newPizzaCount.round();});
},
)
),
Container(
width: 25,
child: Text(this.pizzaCount.toString())
)
]
),
Row(
children: <Widget>[
Icon(FontAwesome5.weight_hanging),
Expanded(
child: Slider(
value: doughBallSize.toDouble(),
min: 100,
max: 400,
divisions: 30,
label: this.doughBallSize.toString(),
onChanged: (double newDoughBallSize) {
setState(() {this.doughBallSize = newDoughBallSize.round();});
},
)
),
Container(
width: 25,
child: Text(this.doughBallSize.toString())
)
]
),
] ]
) )
) )

View file

@ -28,7 +28,8 @@ dependencies:
numberpicker: ^2.1.1 numberpicker: ^2.1.1
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.3
fluttericon: ^2.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: