working return value from add pizza event page
This commit is contained in:
parent
9c4f5916b1
commit
898aba7dbf
2 changed files with 14 additions and 4 deletions
|
@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:pizzaplanner/entities/PizzaEvent.dart';
|
||||||
|
|
||||||
class AddPizzaEventPage extends StatefulWidget {
|
class AddPizzaEventPage extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
|
@ -142,7 +143,13 @@ class AddPizzaEventPageState extends State<AddPizzaEventPage> {
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
child: Text("Add", style: TextStyle(color: Colors.white)),
|
child: Text("Add", style: TextStyle(color: Colors.white)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print("Pressed");
|
Navigator.pop(context, PizzaEvent(
|
||||||
|
this.name,
|
||||||
|
this.pizzaType,
|
||||||
|
this.pizzaCount,
|
||||||
|
this.doughBallSize,
|
||||||
|
this.eventTime
|
||||||
|
));
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,11 +25,14 @@ class PizzaEventsState extends State<PizzaEventsPage> {
|
||||||
separatorBuilder: (BuildContext context, int i) => const Divider(),
|
separatorBuilder: (BuildContext context, int i) => const Divider(),
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
Navigator.pushNamed(
|
final dynamic newPizzaEvent = await Navigator.pushNamed(
|
||||||
context,
|
context,
|
||||||
"/add",
|
"/add",
|
||||||
);
|
);
|
||||||
|
if (newPizzaEvent != null){
|
||||||
|
this.addPizzaEvent(newPizzaEvent);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
tooltip: "Add Pizza Plans",
|
tooltip: "Add Pizza Plans",
|
||||||
child: Center(
|
child: Center(
|
||||||
|
@ -44,7 +47,7 @@ class PizzaEventsState extends State<PizzaEventsPage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPizzaEvent(PizzaEvent, pizzaEvent){
|
void addPizzaEvent(PizzaEvent pizzaEvent){
|
||||||
this.setState(() {
|
this.setState(() {
|
||||||
pizzaEvents.add(
|
pizzaEvents.add(
|
||||||
pizzaEvent
|
pizzaEvent
|
||||||
|
|
Loading…
Add table
Reference in a new issue