alroyso 1 yıl önce
ebeveyn
işleme
e925a9cfff

+ 0 - 33
lib/app/app_module.dart

@@ -1,33 +0,0 @@
-import 'package:flutter_modular/flutter_modular.dart';
-import 'package:naiyouwl/app/pages/home/home_module.dart';
-import 'package:naiyouwl/app/pages/login/login.dart';
-
-class AppModule extends Module {
-  AppModule();
-
-  // @override
-  // List<Module> get imports => [
-  //   // 在这里添加您需要导入的其他模块
-  //   HomeModule(),
-  // ];
-
-  @override
-  void binds(Injector i) {
-    // 在这里实现您的绑定逻辑
-    print("Binding for AppModule");
-  }
-
-  // @override
-  // void exportedBinds(Injector i) {
-  //   // 在这里实现您的导出绑定逻辑
-  //   print("Exported Binding for AppModule");
-  // }
-
-  @override
-  void routes(RouteManager r) {
-    // 在这里定义您的路由逻辑
-    //print("Routes for AppModule");
-    r.child("/", child: (_) => const LoginPage());
-    r.module("/home", module: HomeModule());
-  }
-}

+ 0 - 20
lib/app/app_widget.dart

@@ -1,20 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_modular/flutter_modular.dart';
-
-class AppWidget extends StatelessWidget {
-  const AppWidget({super.key});
-
-  @override
-  Widget build(BuildContext context) {
-    //Modular.routerDelegate.setNavigatorKey(alice.getNavigatorKey());
-    return MaterialApp.router(
-      title: 'Flutter Slidy',
-      theme: ThemeData(
-        primarySwatch: Colors.blue,
-      ),
-      routerConfig: Modular.routerConfig,
-    );
-  }
-}
-
-

+ 0 - 10
lib/app/pages/home/home_module.dart

@@ -1,10 +0,0 @@
-import 'package:flutter_modular/flutter_modular.dart';
-import 'package:naiyouwl/app/pages/home/home_page.dart';
-
-class HomeModule extends Module {
-  
-  @override
-  void routes(RouteManager r) {
-     r.child("/main", child: (_) => const HomePage());
-  }
-}

+ 0 - 272
lib/app/pages/home/home_page.dart

@@ -1,272 +0,0 @@
-import 'package:flutter/cupertino.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_modular/flutter_modular.dart';
-enum ImageType {
-  CUSTOMER,
-  PROMOTION,
-  TUTORIAL,
-  RENEWAL,
-}
-
-class HomePage extends StatefulWidget {
-  const HomePage({super.key});
-
-  @override
-  State<HomePage> createState() => _HomePageState();
-}
-
-class _HomePageState extends State<HomePage> {
-
-
-
-  final Map<ImageType, String> imageMap = {
-    ImageType.CUSTOMER: "images/main/customer.png",
-    ImageType.PROMOTION: "images/main/promotion.png",
-    ImageType.TUTORIAL: "images/main/tutorial.png",
-    ImageType.RENEWAL: "images/main/renewal.png",
-  };
-
-
-  void onImageTap(ImageType type) {
-    print("${imageMap[type]} tapped as ${type.toString().split('.').last}");
-  }
-
-
-  ConnectionStatus _status = ConnectionStatus.disconnected;
-
-  void _simulateStatusChange() {
-    setState(() {
-      switch (_status) {
-        case ConnectionStatus.disconnected:
-          _status = ConnectionStatus.connecting;
-          break;
-        case ConnectionStatus.connecting:
-          _status = ConnectionStatus.stopped;
-          break;
-        case ConnectionStatus.stopped:
-          _status = ConnectionStatus.disconnected;
-          break;
-      }
-    });
-  }
-
-  @override
-  Widget build(BuildContext context) {
-    // TODO: implement build
-    return  Scaffold(
-      body: Container(
-        decoration: const BoxDecoration(
-            image: DecorationImage(
-              image: AssetImage("images/main/main.png"),
-              fit: BoxFit.fill,
-            )
-        ),
-        child: Column(
-
-          children: [
-            const UserStatusWidget(isActive: true),
-            Padding(
-              padding: const EdgeInsets.fromLTRB(20, 25, 0, 0),
-              child: Row(
-                children: imageMap.entries.expand((entry) {
-                  return [
-                    GestureDetector(
-                      onTap: () => onImageTap(entry.key),
-                      child: Image(
-                        image: AssetImage(entry.value),
-                        width: 60,
-                        height: 60,
-                      ),
-                    ),
-                    //Spacer(), // 平均分配间隔
-                    SizedBox(width: 30),
-                  ];
-                }).toList()..removeLast(), // 删除最后一个Spacer
-              )
-
-            ),
-            const SizedBox(height: 30,),
-            const Padding(
-              padding: EdgeInsets.fromLTRB(30, 0 , 30, 0),
-              child: Row(
-                children: [
-
-                    Text("http://127.0.0.1:5336"),
-                    Spacer(),
-                    Text("socks://127.0.0.1:5337"),
-                ],
-              ),
-            ),
-            ConnectionWidget(status: ConnectionStatus.disconnected,onStatusChange: (con) {
-
-            },)
-          ],
-        )
-      ),
-    );
-  }
-
-}
-
-
-
-
-class UserStatusWidget extends StatefulWidget {
-  final bool isActive;
-
-  const UserStatusWidget({Key? key, required this.isActive}) : super(key: key);
-
-  @override
-  _UserStatusWidgetState createState() => _UserStatusWidgetState();
-}
-
-class _UserStatusWidgetState extends State<UserStatusWidget> {
-  @override
-  Widget build(BuildContext context) {
-    String imagePath = widget.isActive ? "images/main/userstatus.png" : "images/main/userstatusoff.png";
-
-    return Align(
-      alignment: Alignment.topCenter,
-      child: Padding(
-        padding: const EdgeInsets.fromLTRB(10.0, 40.0, 10.0, 10.0),
-        child:
-            Row(
-              children: [
-                const SizedBox(
-                  width: 80,
-                  height: 20,
-                ),
-                Column(
-                  crossAxisAlignment: CrossAxisAlignment.start,  // 这将使子组件从左边开始对齐
-                  children: [
-                    Row(
-                      children: [
-                        const Text("用户名: xxxxx"),
-                        const SizedBox(width: 10,),
-                        Image(
-                          image: AssetImage(imagePath),
-                          width: 100,
-                          height: 30,
-                        ),
-                        const SizedBox(width: 10,),
-                        IconButton(
-                          icon: Image.asset("images/main/refresh.png"),
-                          onPressed: () {
-                            // 刷新操作
-                          },
-                        )
-                      ],
-                    ),
-                    const Text(
-                      '到期时间: xxx-xx-xx',
-                      style: TextStyle(
-                        fontSize: 8.0,  // 设置字体大小为20像素
-                      ),
-                    ),
-                    const Text(
-                      '用户流量: 5G',
-                      style: TextStyle(
-                        fontSize: 8.0,  // 设置字体大小为20像素
-                      ),
-                    )
-                  ],
-                ),
-              ],
-            ),
-           // const SizedBox(height: 10,),  // 可调整间隔
-      ),
-    );
-
-  }
-}
-
-
-enum ConnectionStatus { disconnected, connecting, stopped }
- 
-
-class ConnectionWidget extends StatefulWidget {
-
-  final ConnectionStatus status;
-  final Function(ConnectionStatus) onStatusChange;
-  ConnectionWidget({required this.status, required this.onStatusChange});
-
-  @override
-  _ConnectionWidgetState createState() => _ConnectionWidgetState();
-}
-
-class _ConnectionWidgetState extends State<ConnectionWidget> {
-
-  ConnectionStatus _currentStatus = ConnectionStatus.disconnected;
-  late AssetImage currentImage;
-
-  @override
-  void initState() {
-    super.initState();
-    _updateImage();
-  }
-
-  void _updateStatus() {
-    setState(() {
-      switch (_currentStatus) {
-        case ConnectionStatus.disconnected:
-          _currentStatus = ConnectionStatus.connecting;
-          Future.delayed(const Duration(seconds: 5), () {
-            if (mounted) { // 确保Widget仍然在Widget树中
-              setState(() {
-                _currentStatus = ConnectionStatus.stopped;
-                _updateImage();
-              });
-            }
-          });
-          break;
-        case ConnectionStatus.connecting:
-        // 在"connecting"状态时加入延迟
-
-          //_currentStatus = ConnectionStatus.stopped;
-          break;
-        case ConnectionStatus.stopped:
-          _currentStatus = ConnectionStatus.disconnected;
-          break;
-      }
-      _updateImage();
-    });
-  }
-
-  @override
-  void didUpdateWidget(ConnectionWidget oldWidget) {
-    super.didUpdateWidget(oldWidget);
-    _updateImage();
-  }
-
-  void _updateImage() {
-    switch (_currentStatus) {
-      case ConnectionStatus.disconnected:
-        currentImage = const AssetImage('images/main/disconnected.gif');
-        break;
-      case ConnectionStatus.connecting:
-        currentImage = const AssetImage('images/main/connecting.gif');
-        break;
-      case ConnectionStatus.stopped:
-        currentImage = const AssetImage('images/main/stopped.gif');
-        break;
-    }
-  }
-
-  @override
-  Widget build(BuildContext context) {
-    return GestureDetector(
-      onTap: () {
-        _updateStatus();
-        // Add your action on tap here
-        // ScaffoldMessenger.of(context).showSnackBar(
-        //   SnackBar(content: Text('Status: ${widget.status.toString()}')),
-        // );
-      },
-      child: Image(
-          image: currentImage,
-        width: 250,
-        height: 250,
-      ),
-    );
-  }
-}

+ 0 - 86
lib/app/pages/login/login.dart

@@ -1,86 +0,0 @@
-import 'package:flutter/cupertino.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_modular/flutter_modular.dart';
-
-class LoginPage extends StatefulWidget {
-  const LoginPage({super.key});
-
-  @override
-  State<LoginPage> createState() => _LoginPageState();
-}
-
-class _LoginPageState extends State<LoginPage> {
-  // final width = 375.0;
-  // final height = 680.0;
-
-  @override
-  Widget build(BuildContext context) {
-    // TODO: implement build
-    return Container(
-      decoration: const BoxDecoration(
-          image: DecorationImage(
-            image: AssetImage("images/login/login.png"),
-            fit: BoxFit.fill,
-          )),
-      child: const Text("11111"),
-    );
-
-  }
-}
-
-
-// Padding(
-// padding: const EdgeInsets.fromLTRB(20, 20, 20, 20),
-// child: Form(
-// child: SingleChildScrollView(
-// physics: const NeverScrollableScrollPhysics(),  // 禁用滚动
-// child: Align(
-// alignment: Alignment.center,
-// child: Column(
-// mainAxisAlignment: MainAxisAlignment.center,
-// mainAxisSize: MainAxisSize.min,  // 设置为最小
-// children: [
-// const SizedBox(
-// width: 200,
-// height: 200,
-// ),
-// Padding(
-// padding: const EdgeInsets.fromLTRB(40, 40, 0, 0),
-// child: TextFormField(
-// decoration: const InputDecoration(
-// border: InputBorder.none,
-// labelText: "输入账号",
-// hintText: "输入账号",
-// ),
-// ),
-// ),
-// Padding(
-// padding: const EdgeInsets.fromLTRB(40, 10, 0, 0),
-// child: TextFormField(
-// decoration: const InputDecoration(
-// border: InputBorder.none,
-// labelText: "输入密码",
-// hintText: "输入密码",
-// ),
-// ),
-// ),
-// const SizedBox(
-// width: 200,
-// height: 50,
-// ),
-// Container(
-// width: 150,
-// height: 40,
-// child: ElevatedButton(
-// onPressed: () {
-// Modular.to.navigate("/home/main");
-// },
-// child: const Text("登录"),
-// ),
-// )
-// ],
-// ),
-// ),
-// ),
-// ),
-// ),

+ 10 - 33
lib/main.dart

@@ -1,38 +1,15 @@
 import 'package:flutter/material.dart';
-import 'package:flutter_modular/flutter_modular.dart';
-import 'package:window_manager/window_manager.dart';
 
-import 'app/app_module.dart';
-import 'app/app_widget.dart';
+import 'package:get/get.dart';
 
-void main() async {
-  const width = 375.0;
-  const height = 680.0;
-  WidgetsFlutterBinding.ensureInitialized();
-  await windowManager.ensureInitialized();
-  WindowOptions windowOptions = const WindowOptions(
-    minimumSize: Size(width, height),
-    maximumSize: Size(width, height),
-    size: Size(width, height),
-    center: true,
-    backgroundColor: Colors.transparent,
-    skipTaskbar: false,
-    titleBarStyle: TitleBarStyle.hidden,
-  );
-
-  await windowManager.waitUntilReadyToShow(windowOptions, () async {
-    await windowManager.show();
-    await windowManager.focus();
-  });
+import 'app/routes/app_pages.dart';
 
-  runApp(ModularApp(
-      module: AppModule(),
-      child: ConstrainedBox(
-          constraints: const BoxConstraints(
-            maxWidth: width,
-            maxHeight: height,
-          ),
-          child: const AppWidget()),
-      )
-      );
+void main() {
+  runApp(
+    GetMaterialApp(
+      title: "Application",
+      initialRoute: AppPages.INITIAL,
+      getPages: AppPages.routes,
+    ),
+  );
 }

+ 16 - 82
pubspec.yaml

@@ -1,66 +1,28 @@
 name: naiyouwl
-description: naiyou
-# The following line prevents the package from being accidentally published to
-# pub.dev using `flutter pub publish`. This is preferred for private packages.
-publish_to: 'none' # Remove this line if you wish to publish to pub.dev
-
-# The following defines the version and build number for your application.
-# A version number is three numbers separated by dots, like 1.2.43
-# followed by an optional build number separated by a +.
-# Both the version and the builder number may be overridden in flutter
-# build by specifying --build-name and --build-number, respectively.
-# In Android, build-name is used as versionName while build-number used as versionCode.
-# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
-# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
-# Read more about iOS versioning at
-# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-# In Windows, build-name is used as the major, minor, and patch parts
-# of the product and file versions while build-number is used as the build suffix.
 version: 1.0.0+1
-
-environment:
+publish_to: none
+description: naiyou
+environment: 
   sdk: '>=3.1.1 <4.0.0'
 
-# Dependencies specify other packages that your package needs in order to work.
-# To automatically upgrade your package dependencies to the latest versions
-# consider running `flutter pub upgrade --major-versions`. Alternatively,
-# dependencies can be manually updated by changing the version numbers below to
-# the latest version available on pub.dev. To see which dependencies have newer
-# versions available, run `flutter pub outdated`.
-dependencies:
-  flutter:
-    sdk: flutter
-
-
-  # The following adds the Cupertino Icons font to your application.
-  # Use with the CupertinoIcons class for iOS style icons.
+dependencies: 
   cupertino_icons: ^1.0.2
-  flutter_modular: ^6.3.2
   window_manager: ^0.3.6
-
-dev_dependencies:
-  flutter_test:
+  http: ^1.1.0
+  provider: ^6.0.5
+  logger: ^2.0.2+1
+  intl: ^0.18.1
+  get: 4.6.6
+  flutter: 
     sdk: flutter
 
-  # The "flutter_lints" package below contains a set of recommended lints to
-  # encourage good coding practices. The lint set provided by the package is
-  # activated in the `analysis_options.yaml` file located at the root of your
-  # package. See that file for information about deactivating specific lint
-  # rules and activating additional ones.
+dev_dependencies: 
   flutter_lints: ^2.0.0
+  flutter_test: 
+    sdk: flutter
 
-# For information on the generic Dart part of this file, see the
-# following page: https://dart.dev/tools/pub/pubspec
-
-# The following section is specific to Flutter packages.
-flutter:
-
-  # The following line ensures that the Material Icons font is
-  # included with your application, so that you can use the icons in
-  # the material Icons class.
-  uses-material-design: true
-
-  assets:
+flutter: 
+  assets: 
     - images/login/login.png
     - images/main/main.png
     - images/main/refresh.png
@@ -73,33 +35,5 @@ flutter:
     - images/main/disconnected.gif
     - images/main/connecting.gif
     - images/main/stopped.gif
-  # To add assets to your application, add an assets section, like this:
-  # assets:
-  #   - images/a_dot_burr.jpeg
-  #   - images/a_dot_ham.jpeg
-
-  # An image asset can refer to one or more resolution-specific "variants", see
-  # https://flutter.dev/assets-and-images/#resolution-aware
-
-  # For details regarding adding assets from package dependencies, see
-  # https://flutter.dev/assets-and-images/#from-packages
+  uses-material-design: true
 
-  # To add custom fonts to your application, add a fonts section here,
-  # in this "flutter" section. Each entry in this list should have a
-  # "family" key with the font family name, and a "fonts" key with a
-  # list giving the asset and other descriptors for the font. For
-  # example:
-  # fonts:
-  #   - family: Schyler
-  #     fonts:
-  #       - asset: fonts/Schyler-Regular.ttf
-  #       - asset: fonts/Schyler-Italic.ttf
-  #         style: italic
-  #   - family: Trajan Pro
-  #     fonts:
-  #       - asset: fonts/TrajanPro.ttf
-  #       - asset: fonts/TrajanPro_Bold.ttf
-  #         weight: 700
-  #
-  # For details regarding fonts from package dependencies,
-  # see https://flutter.dev/custom-fonts/#from-packages