diff --git a/circle_app/asset/images/login/add.png b/circle_app/asset/images/login/add.png new file mode 100644 index 0000000..180b83f Binary files /dev/null and b/circle_app/asset/images/login/add.png differ diff --git a/circle_app/asset/images/login/down_arr.png b/circle_app/asset/images/login/down_arr.png new file mode 100644 index 0000000..8e82b55 Binary files /dev/null and b/circle_app/asset/images/login/down_arr.png differ diff --git a/circle_app/asset/images/navigator/back.png b/circle_app/asset/images/navigator/back.png new file mode 100644 index 0000000..8f6e274 Binary files /dev/null and b/circle_app/asset/images/navigator/back.png differ diff --git a/circle_app/asset/images/tabbar/circle_normal.png b/circle_app/asset/images/tabbar/circle_normal.png new file mode 100644 index 0000000..980a8f2 Binary files /dev/null and b/circle_app/asset/images/tabbar/circle_normal.png differ diff --git a/circle_app/asset/images/tabbar/circle_selected.png b/circle_app/asset/images/tabbar/circle_selected.png new file mode 100644 index 0000000..d168104 Binary files /dev/null and b/circle_app/asset/images/tabbar/circle_selected.png differ diff --git a/circle_app/asset/images/tabbar/mine_normal.png b/circle_app/asset/images/tabbar/mine_normal.png new file mode 100644 index 0000000..3013476 Binary files /dev/null and b/circle_app/asset/images/tabbar/mine_normal.png differ diff --git a/circle_app/asset/images/tabbar/mine_selected.png b/circle_app/asset/images/tabbar/mine_selected.png new file mode 100644 index 0000000..96f8bc1 Binary files /dev/null and b/circle_app/asset/images/tabbar/mine_selected.png differ diff --git a/circle_app/asset/images/tabbar/msg_normal.png b/circle_app/asset/images/tabbar/msg_normal.png new file mode 100644 index 0000000..e95c16b Binary files /dev/null and b/circle_app/asset/images/tabbar/msg_normal.png differ diff --git a/circle_app/asset/images/tabbar/msg_selected.png b/circle_app/asset/images/tabbar/msg_selected.png new file mode 100644 index 0000000..bd85fbf Binary files /dev/null and b/circle_app/asset/images/tabbar/msg_selected.png differ diff --git a/circle_app/lib/app/home/binding.dart b/circle_app/lib/app/home/binding.dart new file mode 100644 index 0000000..80dd392 --- /dev/null +++ b/circle_app/lib/app/home/binding.dart @@ -0,0 +1,10 @@ +import 'package:get/get.dart'; + +import 'logic.dart'; + +class HomeBinding extends Bindings { + @override + void dependencies() { + Get.lazyPut(() => HomeLogic()); + } +} diff --git a/circle_app/lib/app/home/logic.dart b/circle_app/lib/app/home/logic.dart new file mode 100644 index 0000000..352b907 --- /dev/null +++ b/circle_app/lib/app/home/logic.dart @@ -0,0 +1,7 @@ +import 'package:get/get.dart'; + +import 'state.dart'; + +class HomeLogic extends GetxController { + final HomeState state = HomeState(); +} diff --git a/circle_app/lib/app/home/state.dart b/circle_app/lib/app/home/state.dart new file mode 100644 index 0000000..6953451 --- /dev/null +++ b/circle_app/lib/app/home/state.dart @@ -0,0 +1,5 @@ +class HomeState { + HomeState() { + ///Initialize variables + } +} diff --git a/circle_app/lib/app/home/view.dart b/circle_app/lib/app/home/view.dart new file mode 100644 index 0000000..c774fbd --- /dev/null +++ b/circle_app/lib/app/home/view.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import 'logic.dart'; + +class HomePage extends StatelessWidget { + HomePage({Key? key}) : super(key: key); + + final logic = Get.lazyPut(() => HomeLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.red, + ); + } +} diff --git a/circle_app/lib/common/values/values.dart b/circle_app/lib/common/values/values.dart new file mode 100644 index 0000000..d928061 --- /dev/null +++ b/circle_app/lib/common/values/values.dart @@ -0,0 +1,4 @@ +const String images = 'assets/images/'; +const String login_images = 'assets/images/login'; +const String navigator_images = 'assets/images/navigator'; +const String tabbar_images = 'assets/images/tabbar'; \ No newline at end of file diff --git a/circle_app/lib/main.dart b/circle_app/lib/main.dart index 008fa38..828cb73 100644 --- a/circle_app/lib/main.dart +++ b/circle_app/lib/main.dart @@ -1,4 +1,10 @@ +import 'package:circle_app/app/home/binding.dart'; +import 'package:circle_app/app/home/view.dart'; +import 'package:circle_app/router/app_pages.dart'; +import 'package:circle_app/router/app_routers.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; void main() { runApp(const MyApp()); @@ -10,106 +16,17 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - // This is the theme of your application. - // - // Try running your application with "flutter run". You'll see the - // application has a blue toolbar. Then, without quitting the app, try - // changing the primarySwatch below to Colors.green and then invoke - // "hot reload" (press "r" in the console where you ran "flutter run", - // or simply save your changes to "hot reload" in a Flutter IDE). - // Notice that the counter didn't reset back to zero; the application - // is not restarted. - primarySwatch: Colors.blue, - ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), - ); - } -} - -class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); - - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. - - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". - - final String title; - - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. - return Scaffold( - appBar: AppBar( - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. - title: Text(widget.title), - ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Invoke "debug painting" (press "p" in the console, choose the - // "Toggle Debug Paint" action from the Flutter Inspector in Android - // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) - // to see the wireframe for each widget. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headlineMedium, - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. - ); + //填入设计稿中设备的屏幕尺寸,单位dp + return ScreenUtilInit( + designSize: const Size(375, 812), + minTextAdapt: true, + splitScreenMode: true, + builder: (context, child) { + return GetMaterialApp( + title: 'Flutter Demo', + initialBinding: HomeBinding(), + home: HomePage(), + ); + }); } } diff --git a/circle_app/lib/router/app_pages.dart b/circle_app/lib/router/app_pages.dart new file mode 100644 index 0000000..bfdebe4 --- /dev/null +++ b/circle_app/lib/router/app_pages.dart @@ -0,0 +1,16 @@ +import 'package:circle_app/app/home/binding.dart'; +import 'package:circle_app/app/home/view.dart'; +import 'package:get/get_navigation/src/routes/get_route.dart'; + +import 'app_routers.dart'; + +class AppPages { + + static final routes = [ + GetPage( + name: AppRoutes.Home, + page: () => HomePage(), + binding: HomeBinding(), + ), + ]; +} diff --git a/circle_app/lib/router/app_routers.dart b/circle_app/lib/router/app_routers.dart new file mode 100644 index 0000000..b52a4fd --- /dev/null +++ b/circle_app/lib/router/app_routers.dart @@ -0,0 +1,3 @@ +abstract class AppRoutes { + static const Home = '/home'; +} \ No newline at end of file diff --git a/circle_app/pubspec.lock b/circle_app/pubspec.lock index b2cb69d..6c98caf 100644 --- a/circle_app/pubspec.lock +++ b/circle_app/pubspec.lock @@ -70,11 +70,27 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + flutter_screenutil: + dependency: "direct main" + description: + name: flutter_screenutil + sha256: "0a122936b450324cbdfd51be0819cc6fcebb093eb65585e9cd92263f7a1a8a39" + url: "https://pub.dev" + source: hosted + version: "5.7.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + get: + dependency: "direct main" + description: + name: get + sha256: "2ba20a47c8f1f233bed775ba2dd0d3ac97b4cf32fc17731b3dfc672b06b0e92a" + url: "https://pub.dev" + source: hosted + version: "4.6.5" js: dependency: transitive description: diff --git a/circle_app/pubspec.yaml b/circle_app/pubspec.yaml index 73f0735..d6e648c 100644 --- a/circle_app/pubspec.yaml +++ b/circle_app/pubspec.yaml @@ -35,6 +35,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + get: ^4.5.0 + flutter_screenutil: ^5.6.0 dev_dependencies: flutter_test: @@ -59,8 +61,8 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg + assets: + - assets/images/ # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see