athrainsky пре 1 година
родитељ
комит
41cb1f7bc6
4 измењених фајлова са 19 додато и 8 уклоњено
  1. 5 5
      lib/list.dart
  2. 5 2
      lib/listblock.dart
  3. 8 0
      pubspec.lock
  4. 1 1
      pubspec.yaml

+ 5 - 5
lib/list.dart

@@ -1,6 +1,7 @@
 import 'package:flutter/material.dart';
 import 'package:go_router/go_router.dart';
 import 'package:namer_app/data.dart';
+import 'package:date_format/date_format.dart';
 
 class ListPage extends StatelessWidget {
   const ListPage({Key? key}) : super(key: key);
@@ -13,8 +14,8 @@ class ListPage extends StatelessWidget {
           automaticallyImplyLeading: false,
           toolbarHeight: 44,
           title: Text(
-            // date,
-            '${date.hour}:${date.minute}',
+            date,
+            // '${date.hour}:${date.minute}',
             style: TextStyle(color: Colors.white, fontSize: 15),
           ),
           actions: [
@@ -118,9 +119,8 @@ class Data {
   Data({required this.type, required this.color, required this.image});
 }
 
-// DateTime now = DateTime.now();
-// String date = DateFormat('kk:mm').format(now);
-var date = DateTime.now();
+var date = formatDate(DateTime.now(), [HH, ':', nn]);
+// var date = DateTime.now();
 
 class AvailableMenu extends StatelessWidget {
   const AvailableMenu({

+ 5 - 2
lib/listblock.dart

@@ -1,5 +1,6 @@
 import 'package:flutter/material.dart';
 import 'package:namer_app/data.dart';
+import 'package:date_format/date_format.dart';
 
 class ListBlockPage extends StatelessWidget {
   const ListBlockPage({Key? key}) : super(key: key);
@@ -12,7 +13,8 @@ class ListBlockPage extends StatelessWidget {
           automaticallyImplyLeading: false,
           toolbarHeight: 44,
           title: Text(
-            '${date.hour}:${date.minute}',
+            date,
+            // '${date.hour}:${date.minute}',
             style: TextStyle(color: Colors.white, fontSize: 15),
           ),
           actions: [
@@ -111,7 +113,8 @@ class Data {
   Data({required this.type, required this.color, required this.image});
 }
 
-var date = DateTime.now();
+var date = formatDate(DateTime.now(), [HH, ':', nn]);
+// var date = DateTime.now();
 
 class AvailableMenu extends StatelessWidget {
   const AvailableMenu({

+ 8 - 0
pubspec.lock

@@ -41,6 +41,14 @@ packages:
       url: "https://pub.dev"
     source: hosted
     version: "1.17.0"
+  date_format:
+    dependency: "direct main"
+    description:
+      name: date_format
+      sha256: "8e5154ca363411847220c8cbc43afcf69c08e8debe40ba09d57710c25711760c"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.0.7"
   english_words:
     dependency: "direct main"
     description:

+ 1 - 1
pubspec.yaml

@@ -16,7 +16,7 @@ dependencies:
   provider: ^6.0.0
   go_router: ^6.0.2
   flutter_layout_grid: ^1.0.3
-  # intl: ^0.15.7
+  date_format: ^2.0.7
 
 dev_dependencies:
   flutter_test: