renamed 'planned pizza' to 'pizza event' everywhere
This commit is contained in:
parent
c1f1e4e78a
commit
1a50f2ca0c
7 changed files with 81 additions and 81 deletions
7
lib/entities/PizzaEvent.dart
Normal file
7
lib/entities/PizzaEvent.dart
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
class PizzaEvent {
|
||||||
|
final String name;
|
||||||
|
final DateTime dateTime;
|
||||||
|
|
||||||
|
PizzaEvent(this.name, this.dateTime);
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
|
|
||||||
class PlannedPizza {
|
|
||||||
final String name;
|
|
||||||
final DateTime dateTime;
|
|
||||||
|
|
||||||
PlannedPizza(this.name, this.dateTime);
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:pizzaplanner/pages/AddPlannedPizzaPage.dart';
|
import 'package:pizzaplanner/pages/AddPizzaEventPage.dart';
|
||||||
import 'package:pizzaplanner/pages/PlannedPizzasPage.dart';
|
import 'package:pizzaplanner/pages/PizzaEventsPage.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(PizzaPlanner());
|
runApp(PizzaPlanner());
|
||||||
|
@ -12,7 +12,7 @@ class PizzaPlanner extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: "PizzaPlanner",
|
title: "PizzaPlanner",
|
||||||
home: PlannedPizzasPage(),
|
home: PizzaEventsPage(),
|
||||||
onGenerateRoute: RouteGenerator.generateRoute,
|
onGenerateRoute: RouteGenerator.generateRoute,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -22,14 +22,14 @@ class RouteGenerator {
|
||||||
static Route<dynamic> generateRoute(RouteSettings settings){
|
static Route<dynamic> generateRoute(RouteSettings settings){
|
||||||
switch(settings.name){
|
switch(settings.name){
|
||||||
case "/": {
|
case "/": {
|
||||||
return MaterialPageRoute(builder: (context) => PlannedPizzasPage());
|
return MaterialPageRoute(builder: (context) => PizzaEventsPage());
|
||||||
}
|
}
|
||||||
case "/add": {
|
case "/add": {
|
||||||
return MaterialPageRoute(builder: (context) => AddPlannedPizzaPage());
|
return MaterialPageRoute(builder: (context) => AddPizzaEventPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
return MaterialPageRoute(builder: (context) => PlannedPizzasPage());
|
return MaterialPageRoute(builder: (context) => PizzaEventsPage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
|
|
||||||
class AddPlannedPizzaPage extends StatefulWidget {
|
class AddPizzaEventPage extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
AddPlannedPizzaPageState createState() => AddPlannedPizzaPageState();
|
AddPizzaEventPageState createState() => AddPizzaEventPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddPlannedPizzaPageState extends State<AddPlannedPizzaPage> {
|
class AddPizzaEventPageState extends State<AddPizzaEventPage> {
|
||||||
String name = "";
|
String name = "";
|
||||||
String pizzaType = "Neapolitan";
|
String pizzaType = "Neapolitan";
|
||||||
int pizzaCount = 1;
|
int pizzaCount = 1;
|
||||||
|
@ -17,7 +17,7 @@ class AddPlannedPizzaPageState extends State<AddPlannedPizzaPage> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("Add Planned Pizza"),
|
title: Text("Add Pizza Event"),
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
padding: EdgeInsets.fromLTRB(40, 10, 40, 10),
|
padding: EdgeInsets.fromLTRB(40, 10, 40, 10),
|
57
lib/pages/PizzaEventsPage.dart
Normal file
57
lib/pages/PizzaEventsPage.dart
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pizzaplanner/entities/PizzaEvent.dart';
|
||||||
|
import 'package:pizzaplanner/widgets/PizzaEventWidget.dart';
|
||||||
|
|
||||||
|
class PizzaEventsPage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
PizzaEventsState createState() => PizzaEventsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class PizzaEventsState extends State<PizzaEventsPage> {
|
||||||
|
List<PizzaEvent> pizzaEvents = <PizzaEvent>[
|
||||||
|
PizzaEvent("Movie Night", DateTime(2021, 6, 30, 12, 8)),
|
||||||
|
PizzaEvent("Birthday Pizza", DateTime(2021, 7, 14, 18, 30)),
|
||||||
|
PizzaEvent("Something else", DateTime(2021, 9, 3, 15, 3)),
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text("Pizza Events"),
|
||||||
|
),
|
||||||
|
body: ListView.separated(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
itemCount: pizzaEvents.length,
|
||||||
|
itemBuilder: (BuildContext context, int i) => PizzaEventWidget(pizzaEvents[i]),
|
||||||
|
separatorBuilder: (BuildContext context, int i) => const Divider(),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
"/add",
|
||||||
|
);
|
||||||
|
},
|
||||||
|
tooltip: "Add Pizza Plans",
|
||||||
|
child: Center(
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(Icons.add),
|
||||||
|
Icon(Icons.local_pizza_rounded),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addPizzaEvent(){
|
||||||
|
this.setState(() {
|
||||||
|
pizzaEvents.add(
|
||||||
|
PizzaEvent("Added Pizza Party", DateTime(2022, 3, 23, 17, 45))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,57 +0,0 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:pizzaplanner/entities/PlannedPizza.dart';
|
|
||||||
import 'package:pizzaplanner/widgets/PlannedPizzaWidget.dart';
|
|
||||||
|
|
||||||
class PlannedPizzasPage extends StatefulWidget {
|
|
||||||
@override
|
|
||||||
PlannedPizzasState createState() => PlannedPizzasState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class PlannedPizzasState extends State<PlannedPizzasPage> {
|
|
||||||
List<PlannedPizza> plannedPizzas = <PlannedPizza>[
|
|
||||||
PlannedPizza("Movie Night", DateTime(2021, 6, 30, 12, 8)),
|
|
||||||
PlannedPizza("Birthday Pizza", DateTime(2021, 7, 14, 18, 30)),
|
|
||||||
PlannedPizza("Something else", DateTime(2021, 9, 3, 15, 3)),
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
title: Text("Planned Pizzas"),
|
|
||||||
),
|
|
||||||
body: ListView.separated(
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
itemCount: plannedPizzas.length,
|
|
||||||
itemBuilder: (BuildContext context, int i) => PlannedPizzaWidget(plannedPizzas[i]),
|
|
||||||
separatorBuilder: (BuildContext context, int i) => const Divider(),
|
|
||||||
),
|
|
||||||
floatingActionButton: FloatingActionButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context,
|
|
||||||
"/add",
|
|
||||||
);
|
|
||||||
},
|
|
||||||
tooltip: "Add Pizza Plans",
|
|
||||||
child: Center(
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Icon(Icons.add),
|
|
||||||
Icon(Icons.local_pizza_rounded),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void addPlannedPizza(){
|
|
||||||
this.setState(() {
|
|
||||||
plannedPizzas.add(
|
|
||||||
PlannedPizza("Added Pizza Party", DateTime(2022, 3, 23, 17, 45))
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +1,12 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:pizzaplanner/entities/PlannedPizza.dart';
|
import 'package:pizzaplanner/entities/PizzaEvent.dart';
|
||||||
|
|
||||||
class PlannedPizzaWidget extends StatelessWidget {
|
class PizzaEventWidget extends StatelessWidget {
|
||||||
final DateFormat dateFormatter = DateFormat("yyyy-MM-dd hh:mm");
|
final DateFormat dateFormatter = DateFormat("yyyy-MM-dd hh:mm");
|
||||||
final PlannedPizza plannedPizza;
|
final PizzaEvent pizzaEvent;
|
||||||
|
|
||||||
PlannedPizzaWidget(this.plannedPizza);
|
PizzaEventWidget(this.pizzaEvent);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context){
|
Widget build(BuildContext context){
|
||||||
|
@ -21,7 +21,7 @@ class PlannedPizzaWidget extends StatelessWidget {
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(plannedPizza.name),
|
Text(pizzaEvent.name),
|
||||||
Text(this.getTimeRemainingString())
|
Text(this.getTimeRemainingString())
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -66,7 +66,7 @@ class PlannedPizzaWidget extends StatelessWidget {
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(dateFormatter.format(plannedPizza.dateTime)),
|
Text(dateFormatter.format(pizzaEvent.dateTime)),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -75,7 +75,7 @@ class PlannedPizzaWidget extends StatelessWidget {
|
||||||
|
|
||||||
String getTimeRemainingString(){
|
String getTimeRemainingString(){
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
Duration duration = plannedPizza.dateTime.difference(now);
|
Duration duration = pizzaEvent.dateTime.difference(now);
|
||||||
Duration absDuration = duration.abs();
|
Duration absDuration = duration.abs();
|
||||||
String durationString = "";
|
String durationString = "";
|
||||||
if (absDuration.inHours <= 0 && absDuration.inMinutes > 0) {
|
if (absDuration.inHours <= 0 && absDuration.inMinutes > 0) {
|
Loading…
Add table
Reference in a new issue