Commit code. Update time: 2023-06-25
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sail/utils/l10n.dart';
|
||||
|
||||
class Application {
|
||||
static FluroRouter? router;
|
||||
static GlobalKey<NavigatorState> navigatorKey = GlobalKey();
|
||||
static showMsg(context, msg) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text(context.l10n.alertsss),
|
||||
content: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Align(
|
||||
child: Text(
|
||||
msg,
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
alignment: Alignment(0, 0),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
context.l10n.sure,
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
onPressed: () {
|
||||
//print("确定");
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sail/pages/accountPage.dart';
|
||||
import 'package:sail/pages/home/home_page.dart';
|
||||
import 'package:sail/pages/404/not_find_page.dart';
|
||||
import 'package:sail/pages/login/login_page.dart';
|
||||
import 'package:sail/pages/plan/plan_page.dart';
|
||||
import 'package:sail/pages/server_list.dart';
|
||||
import 'package:sail/pages/webview_widget.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
/// 入口
|
||||
Handler homeHandler = Handler(
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> parameters) {
|
||||
return const HomePage();
|
||||
});
|
||||
|
||||
/// 404页面
|
||||
Handler notFindHandler = Handler(
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> parameters) {
|
||||
return const NotFindPage();
|
||||
});
|
||||
|
||||
/// 登录页
|
||||
Handler loginHandler = Handler(
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> parameters) {
|
||||
return const LoginPage();
|
||||
});
|
||||
|
||||
/// 套餐页
|
||||
Handler planHandle = Handler(
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> parameters) {
|
||||
return const PlanPage();
|
||||
});
|
||||
|
||||
/// 服务器节点页
|
||||
Handler serverListHandler = Handler(
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> parameters) {
|
||||
return const ServerListPage();
|
||||
});
|
||||
|
||||
/// WebView页
|
||||
Handler webViewHandler = Handler(
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> parameters) {
|
||||
var title = jsonDecode(parameters["titleName"]!.first);
|
||||
var url = jsonDecode(parameters["url"]!.first);
|
||||
return WebViewWidget(name: title, url: url);
|
||||
});
|
||||
|
||||
///个人中心
|
||||
Handler accountHandler = Handler(
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> parameters) {
|
||||
return const AccountPage();
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:sail/router/router_handlers.dart';
|
||||
|
||||
class Routers {
|
||||
static String home = "/";
|
||||
|
||||
static String login = "/login";
|
||||
static String plan = "/plan";
|
||||
static String serverList = '/server-list';
|
||||
static String webView = "/web-view";
|
||||
static String account = "/account";
|
||||
|
||||
static void configureRoutes(FluroRouter router) {
|
||||
router.notFoundHandler = notFindHandler;
|
||||
|
||||
router.define(home, handler: homeHandler);
|
||||
|
||||
router.define(login, handler: loginHandler);
|
||||
|
||||
router.define(plan, handler: planHandle);
|
||||
|
||||
router.define(serverList, handler: serverListHandler);
|
||||
|
||||
router.define(webView, handler: webViewHandler);
|
||||
|
||||
router.define(account, handler: accountHandler);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user