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:fluttericon/font_awesome5_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:pizzaplanner/entities/PizzaEvent.dart';
|
||||
|
||||
class AddPizzaEventPage extends StatefulWidget {
|
||||
@override
|
||||
|
@ -142,7 +143,13 @@ class AddPizzaEventPageState extends State<AddPizzaEventPage> {
|
|||
child: TextButton(
|
||||
child: Text("Add", style: TextStyle(color: Colors.white)),
|
||||
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(),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
onPressed: () async {
|
||||
final dynamic newPizzaEvent = await Navigator.pushNamed(
|
||||
context,
|
||||
"/add",
|
||||
);
|
||||
if (newPizzaEvent != null){
|
||||
this.addPizzaEvent(newPizzaEvent);
|
||||
}
|
||||
},
|
||||
tooltip: "Add Pizza Plans",
|
||||
child: Center(
|
||||
|
@ -44,7 +47,7 @@ class PizzaEventsState extends State<PizzaEventsPage> {
|
|||
);
|
||||
}
|
||||
|
||||
void addPizzaEvent(PizzaEvent, pizzaEvent){
|
||||
void addPizzaEvent(PizzaEvent pizzaEvent){
|
||||
this.setState(() {
|
||||
pizzaEvents.add(
|
||||
pizzaEvent
|
||||
|
|
Loading…
Add table
Reference in a new issue