format date

This commit is contained in:
Ruidy 2021-07-24 10:15:55 +02:00
parent 8c90fdc85e
commit ab6ea575d7
3 changed files with 12 additions and 1 deletions

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'profile.dart';
@ -30,7 +31,9 @@ class _CalculatorPageState extends State<CalculatorPage> {
(1.2 * bodyMassIndex() + .23 * _age - 10.8 * _gender - 5.4).round();
Future<void> _saveResults() async {
var now = DateTime.now().toString();
var dateFormatter = DateFormat("dd/MM/yyyy");
var now = dateFormatter.format(DateTime.now());
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setStringList(
now,

View file

@ -86,6 +86,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
intl:
dependency: "direct main"
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
js:
dependency: transitive
description:

View file

@ -25,6 +25,7 @@ dependencies:
sdk: flutter
shared_preferences: 2.0.6
intl: ^0.17.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.