removed scattered definitions of date formatter
This commit is contained in:
parent
0fb0c97a44
commit
c73b352d1e
4 changed files with 10 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:pizzaplanner/util.dart';
|
||||
import 'package:pizzaplanner/entities/PizzaRecipe/Ingredient.dart';
|
||||
|
||||
import 'package:pizzaplanner/entities/PizzaRecipe/Ingredients.dart';
|
||||
|
@ -12,7 +12,6 @@ class PizzaRecipe {
|
|||
final String name;
|
||||
final String description;
|
||||
final Ingredients ingredients;
|
||||
final DateFormat dateFormatter = DateFormat("yyyy-MM-dd H:mm");
|
||||
|
||||
final List<RecipeStep> recipeSteps;
|
||||
|
||||
|
@ -104,7 +103,7 @@ class PizzaRecipe {
|
|||
TableRow(
|
||||
children: <TableCell>[
|
||||
TableCell(child: Center(child: Text(recipeStep.name))),
|
||||
TableCell(child: Center(child: Text(dateFormatter.format(dateTime.subtract(stepWaitDuration)))))
|
||||
TableCell(child: Center(child: Text(getDateFormat().format(dateTime.subtract(stepWaitDuration)))))
|
||||
]
|
||||
)
|
||||
);
|
||||
|
|
|
@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
|
|||
import 'package:flutter/material.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';
|
||||
import 'package:pizzaplanner/entities/PizzaRecipe/PizzaRecipe.dart';
|
||||
import 'package:pizzaplanner/util.dart';
|
||||
|
@ -231,7 +230,6 @@ class ConfirmPizzaEventDialog extends StatefulWidget {
|
|||
}
|
||||
|
||||
class ConfirmPizzaEventState extends State<ConfirmPizzaEventDialog> {
|
||||
final DateFormat dateFormatter = DateFormat("yyyy-MM-dd H:mm");
|
||||
late DateTime eventTime;
|
||||
late final DateTime minTime;
|
||||
|
||||
|
@ -270,7 +268,7 @@ class ConfirmPizzaEventState extends State<ConfirmPizzaEventDialog> {
|
|||
children: <Widget>[
|
||||
Icon(FontAwesome5.calendar_alt, color: Colors.white),
|
||||
SizedBox(width: 10),
|
||||
Text(dateFormatter.format(this.eventTime), style: TextStyle(color: Colors.white, fontSize: 25)),
|
||||
Text(getDateFormat().format(this.eventTime), style: TextStyle(color: Colors.white, fontSize: 25)),
|
||||
]
|
||||
),
|
||||
onPressed: () {
|
||||
|
@ -281,7 +279,7 @@ class ConfirmPizzaEventState extends State<ConfirmPizzaEventDialog> {
|
|||
maxTime: DateTime.now().add(Duration(days: 365*10)),
|
||||
onConfirm: (newEventTime) {
|
||||
setState((){ this.eventTime = newEventTime; });
|
||||
print(dateFormatter.format(newEventTime));
|
||||
print(getDateFormat().format(newEventTime));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:pizzaplanner/entities/PizzaRecipe/PizzaRecipe.dart';
|
||||
|
||||
Future<List<PizzaRecipe>> getRecipes() async {
|
||||
|
@ -25,4 +26,8 @@ extension StringExtensions on String {
|
|||
String capitalize() {
|
||||
return this[0].toUpperCase() + this.substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
DateFormat getDateFormat(){
|
||||
return DateFormat("yyyy-MM-dd H:mm");
|
||||
}
|
|
@ -3,7 +3,6 @@ import 'package:intl/intl.dart';
|
|||
import 'package:pizzaplanner/entities/PizzaEvent.dart';
|
||||
|
||||
class PizzaEventWidget extends StatelessWidget {
|
||||
final DateFormat dateFormatter = DateFormat("yyyy-MM-dd hh:mm");
|
||||
final PizzaEvent pizzaEvent;
|
||||
|
||||
PizzaEventWidget(this.pizzaEvent);
|
||||
|
@ -69,7 +68,7 @@ class PizzaEventWidget extends StatelessWidget {
|
|||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(dateFormatter.format(pizzaEvent.dateTime)),
|
||||
Text(util.get.format(pizzaEvent.dateTime)),
|
||||
Text(pizzaEvent.recipe.name)
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue