athrainsky 1 год назад
Родитель
Сommit
38b3d081bd
4 измененных файлов с 76 добавлено и 101 удалено
  1. 49 0
      lib/data.dart
  2. 11 46
      lib/list.dart
  3. 10 45
      lib/listblock.dart
  4. 6 10
      lib/main.dart

+ 49 - 0
lib/data.dart

@@ -0,0 +1,49 @@
+import 'package:flutter/material.dart';
+import 'package:namer_app/list.dart';
+
+final List<Data> items = [
+  Data(
+      type: 'Foods & Drinks',
+      color: Color(0xffCCA600),
+      image: 'assets/images/food.png'),
+  Data(
+      type: 'Services',
+      color: Color(0xff90D8F9),
+      image: 'assets/images/service.png'),
+  Data(
+      type: 'Additional',
+      color: Color(0xffAACEE0),
+      image: 'assets/images/additional.png'),
+  Data(
+      type: 'First Aid',
+      color: Color(0xffFF1111),
+      image: 'assets/images/firstaid.png'),
+  Data(
+      type: 'Ticket',
+      color: Color(0xff5ED8F6),
+      image: 'assets/images/ticket.png'),
+  Data(
+      type: 'Vacation',
+      color: Color(0xffCCA600),
+      image: 'assets/images/vacation.png'),
+  Data(
+      type: 'Transportation',
+      color: Color(0xff6C8BA5),
+      image: 'assets/images/transportation.png'),
+  Data(
+      type: 'First Aid',
+      color: Color(0xffFF1111),
+      image: 'assets/images/firstaid.png'),
+  Data(
+      type: 'Foods & Drinks',
+      color: Color(0xffCCA600),
+      image: 'assets/images/food.png'),
+  Data(
+      type: 'Services',
+      color: Color(0xff90D8F9),
+      image: 'assets/images/service.png'),
+  Data(
+      type: 'Additional',
+      color: Color(0xffAACEE0),
+      image: 'assets/images/additional.png'),
+];

+ 11 - 46
lib/list.dart

@@ -1,42 +1,12 @@
 import 'package:flutter/material.dart';
 import 'package:go_router/go_router.dart';
-// import 'package:intl/intl.dart';
+import 'package:namer_app/data.dart';
 
 class ListPage extends StatelessWidget {
   const ListPage({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
-    final List<Data> items = [
-      Data(
-          type: 'Foods & Drinks',
-          color: Color(0xffCCA600),
-          image: 'assets/images/food.png'),
-      Data(
-          type: 'Services',
-          color: Color(0xff90D8F9),
-          image: 'assets/images/service.png'),
-      Data(
-          type: 'Additional',
-          color: Color(0xffAACEE0),
-          image: 'assets/images/additional.png'),
-      Data(
-          type: 'First Aid',
-          color: Color(0xffFF1111),
-          image: 'assets/images/firstaid.png'),
-      Data(
-          type: 'Ticket',
-          color: Color(0xff5ED8F6),
-          image: 'assets/images/ticket.png'),
-      Data(
-          type: 'Vacation',
-          color: Color(0xffCCA600),
-          image: 'assets/images/vacation.png'),
-      Data(
-          type: 'Transportation',
-          color: Color(0xff6C8BA5),
-          image: 'assets/images/transportation.png'),
-    ];
     return Scaffold(
         appBar: AppBar(
           backgroundColor: Color(0xff078C84),
@@ -79,10 +49,16 @@ class ListPage extends StatelessWidget {
                   border: Border.all(color: Color(0xff078C84))),
               child: Column(
                 children: [
+                  Container(
+                    margin: EdgeInsets.symmetric(vertical: 5),
+                    color: Color(0xff292D32).withOpacity(0.15),
+                    height: 1,
+                    width: 24,
+                  ),
                   TopMenu(),
                   Column(
                     children: List.generate(
-                        items.length,
+                        7,
                         (i) => SizedBox(
                               child: ListTile(
                                 leading: gambar(items[i]),
@@ -117,7 +93,7 @@ class ListPage extends StatelessWidget {
         ]));
   }
 
-  Container gambar(Data items) {
+  Container gambar(items) {
     return Container(
       decoration: BoxDecoration(
           border: Border.all(color: items.color),
@@ -186,22 +162,11 @@ class TopMenu extends StatelessWidget {
             style: TextStyle(
                 fontWeight: FontWeight.bold, color: Color(0xff292D32)),
           ),
-          Expanded(
-            child: Column(
-              mainAxisAlignment: MainAxisAlignment.center,
-              children: [
-                Container(
-                  color: Color(0xff292D32).withOpacity(0.15),
-                  height: 1,
-                  width: 24,
-                ),
-              ],
-            ),
-          ),
+          Spacer(),
           ElevatedButton(
               style: ElevatedButton.styleFrom(
                   backgroundColor: Color(0xff078C84).withOpacity(0.1)),
-              onPressed: () => context.go('/listblock'),
+              onPressed: () => context.go('/list/listblock'),
               child: Text(
                 'Done',
                 style: TextStyle(

+ 10 - 45
lib/listblock.dart

@@ -1,41 +1,11 @@
 import 'package:flutter/material.dart';
-// import 'package:flutter_layout_grid/flutter_layout_grid.dart';
+import 'package:namer_app/data.dart';
 
 class ListBlockPage extends StatelessWidget {
   const ListBlockPage({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
-    final List<Data> items = [
-      Data(
-          type: 'Foods & Drinks',
-          color: Color(0xffCCA600),
-          image: 'assets/images/food.png'),
-      Data(
-          type: 'Services',
-          color: Color(0xff90D8F9),
-          image: 'assets/images/service.png'),
-      Data(
-          type: 'Additional',
-          color: Color(0xffAACEE0),
-          image: 'assets/images/additional.png'),
-      Data(
-          type: 'First Aid',
-          color: Color(0xffFF1111),
-          image: 'assets/images/firstaid.png'),
-      Data(
-          type: 'Ticket',
-          color: Color(0xff5ED8F6),
-          image: 'assets/images/ticket.png'),
-      Data(
-          type: 'Vacation',
-          color: Color(0xffCCA600),
-          image: 'assets/images/vacation.png'),
-      Data(
-          type: 'Transportation',
-          color: Color(0xff6C8BA5),
-          image: 'assets/images/transportation.png'),
-    ];
     return Scaffold(
         appBar: AppBar(
           backgroundColor: Color(0xff078C84),
@@ -76,6 +46,12 @@ class ListBlockPage extends StatelessWidget {
                 border: Border.all(color: Color(0xff078C84))),
             child: Column(
               children: [
+                Container(
+                  margin: EdgeInsets.symmetric(vertical: 5),
+                  color: Color(0xff292D32).withOpacity(0.15),
+                  height: 1,
+                  width: 24,
+                ),
                 TopMenu(),
                 GridView.builder(
                   shrinkWrap: true,
@@ -88,7 +64,7 @@ class ListBlockPage extends StatelessWidget {
                       Text(items[index].type),
                     ],
                   ),
-                  itemCount: items.length,
+                  itemCount: 7,
                 ),
                 AvailableMenu(),
                 GridView.builder(
@@ -110,7 +86,7 @@ class ListBlockPage extends StatelessWidget {
         ]));
   }
 
-  Container gambar(Data items) {
+  Container gambar(items) {
     return Container(
       decoration: BoxDecoration(
           border: Border.all(color: items.color),
@@ -177,18 +153,7 @@ class TopMenu extends StatelessWidget {
             style: TextStyle(
                 fontWeight: FontWeight.bold, color: Color(0xff292D32)),
           ),
-          Expanded(
-            child: Column(
-              mainAxisAlignment: MainAxisAlignment.center,
-              children: [
-                Container(
-                  color: Color(0xff292D32).withOpacity(0.15),
-                  height: 1,
-                  width: 24,
-                ),
-              ],
-            ),
-          ),
+          Spacer(),
           ElevatedButton(
               style: ElevatedButton.styleFrom(
                   backgroundColor: Color(0xff078C84).withOpacity(0.1)),

+ 6 - 10
lib/main.dart

@@ -20,17 +20,13 @@ final _router = GoRouter(
       GoRoute(
         path: 'list',
         builder: (context, state) => ListPage(),
-        // routes: [
-        //   GoRoute(
-        //     path: 'listblock',
-        //     builder: (context, state) => ListBlockPage(),
-        //   )
-        // ],
+        routes: [
+          GoRoute(
+            path: 'listblock',
+            builder: (context, state) => ListBlockPage(),
+          )
+        ],
       ),
-      GoRoute(
-        path: 'listblock',
-        builder: (context, state) => ListBlockPage(),
-      )
     ]),
   ],
 );