liuyuqi-dellpc 1 year ago
parent
commit
c8929705e1

+ 1 - 0
lib/main.dart

@@ -14,6 +14,7 @@ class MyApp extends StatelessWidget {
   Widget build(BuildContext context) {
     return GetMaterialApp(
       title: 'Flutter get 状态管理demo',
+      debugShowCheckedModeBanner: false,
       theme: ThemeData(
         primarySwatch: Colors.blue,
       ),

+ 9 - 12
lib/pages/home/home_view.dart

@@ -17,21 +17,18 @@ class HomeView extends GetView<HomeController> {
             itemCount: controller.state.goodsData.length,
             itemBuilder: (context, index) {
               return ListTile(
-                title: Text(controller.state.goodsData[index].title ??
-                    ''),
-                trailing: InkWell(
-                    onTap: () {
-                      controller.toDetail(index);
-                    },
-                    child: Obx(() {
-                      return Text(controller.state.likeList.contains(
-                          controller.state.goodsData[index]) ? '已收藏' : '收藏商品');
-                    })
-                ),
+                title: Text(controller.state.goodsData[index].title ?? ''),
+                trailing: InkWell(onTap: () {
+                  controller.toDetail(index);
+                }, child: Obx(() {
+                  return Text(controller.state.likeList
+                          .contains(controller.state.goodsData[index])
+                      ? '已收藏'
+                      : '收藏商品');
+                })),
               );
             });
       }),
-
     );
   }
 }

+ 0 - 18
lib/pages/home_page.dart

@@ -1,18 +0,0 @@
-import 'package:flutter/material.dart';
-
-/// Description: home page
-/// Time       : 05/06/2023 Saturday
-/// Author     : liuyuqi.gov@msn.cn
-class HomePage extends StatefulWidget {
-  const HomePage({super.key});
-
-  @override
-  State<HomePage> createState() => _HomePageState();
-}
-
-class _HomePageState extends State<HomePage> {
-  @override
-  Widget build(BuildContext context) {
-    return const Placeholder();
-  }
-}

+ 0 - 3
lib/pages/second/second_view.dart

@@ -12,9 +12,6 @@ class SecondView extends GetView<SecondController> {
         appBar: AppBar(
           title: const Text('SecondView'),
           centerTitle: true,
-          // leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: () {
-          //   controller.getBack();
-          // },),
         ),
         body: Obx(() {
           return Row(

+ 0 - 18
lib/pages/second_page.dart

@@ -1,18 +0,0 @@
-import 'package:flutter/material.dart';
-
-/// Description: second page
-/// Time       : 05/06/2023 Saturday
-/// Author     : liuyuqi.gov@msn.cn
-class SecondPage extends StatefulWidget {
-  const SecondPage({super.key});
-
-  @override
-  State<SecondPage> createState() => _SecondPageState();
-}
-
-class _SecondPageState extends State<SecondPage> {
-  @override
-  Widget build(BuildContext context) {
-    return const Placeholder();
-  }
-}

+ 2 - 1
lib/routes.dart

@@ -13,6 +13,7 @@ class Routes {
 
   static final routes = [
     GetPage(name: home, page: () => const HomeView(), binding: HomeBinding()),
-    GetPage(name: second, page: () => const SecondView(), binding: SecondBinding())
+    GetPage(
+        name: second, page: () => const SecondView(), binding: SecondBinding())
   ];
 }