提交
This commit is contained in:
+13
-13
@@ -1,14 +1,14 @@
|
||||
import 'package:app/core/router/app_router.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp.router(
|
||||
title: '测试应用',
|
||||
routerConfig:appRouter
|
||||
);
|
||||
}
|
||||
import 'package:app/core/router/app_router.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp.router(
|
||||
title: '测试应用',
|
||||
routerConfig:appRouter
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'dart:ui';
|
||||
|
||||
class AppColors {
|
||||
static const Color primaryColor = Color(0xFF4FDBFF); // 微信绿
|
||||
import 'dart:ui';
|
||||
|
||||
class AppColors {
|
||||
static const Color primaryColor = Color(0xFF4FDBFF); // 微信绿
|
||||
}
|
||||
@@ -1,26 +1,26 @@
|
||||
|
||||
|
||||
import 'package:app/features/auth/pages/login_page.dart';
|
||||
import 'package:app/features/home/pages/index_page.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../features/home/pages/main_page.dart';
|
||||
|
||||
final appRouter = GoRouter(
|
||||
initialLocation: '/auth/login',
|
||||
routes: [
|
||||
GoRoute(path: '/auth/login', builder: (context, state) => const LoginPage()),
|
||||
ShellRoute(
|
||||
builder: (context, state, child) {
|
||||
return MainPage(child: child);
|
||||
},
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => const IndexPage()
|
||||
)
|
||||
]
|
||||
)
|
||||
],
|
||||
|
||||
|
||||
|
||||
import 'package:app/features/auth/pages/login_page.dart';
|
||||
import 'package:app/features/home/pages/index_page.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../features/home/pages/main_page.dart';
|
||||
|
||||
final appRouter = GoRouter(
|
||||
initialLocation: '/auth/login',
|
||||
routes: [
|
||||
GoRoute(path: '/auth/login', builder: (context, state) => const LoginPage()),
|
||||
ShellRoute(
|
||||
builder: (context, state, child) {
|
||||
return MainPage(child: child);
|
||||
},
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => const IndexPage()
|
||||
)
|
||||
]
|
||||
)
|
||||
],
|
||||
|
||||
);
|
||||
@@ -1,167 +1,167 @@
|
||||
import 'package:app/core/constants/app_colors.dart';
|
||||
import 'package:app/features/auth/pages/login_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoginPageState extends State<LoginPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text("找回密码", style: TextStyle(color: Colors.grey)),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
// 1. 品牌Logo/头像区域
|
||||
Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primaryColor.withOpacity(0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.person_rounded,
|
||||
size: 60,
|
||||
color: AppColors.primaryColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
"登录您的聊天账号",
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
|
||||
// 2. 账号输入框 (极简下划线风格)
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: "账号 / 邮箱 / 手机号",
|
||||
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade300),
|
||||
),
|
||||
focusedBorder: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
|
||||
// 3. 密码输入框
|
||||
TextField(
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: "请输入密码",
|
||||
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade300),
|
||||
),
|
||||
focusedBorder: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
|
||||
// 4. 登录按钮 (圆润大按钮)
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
"登 录",
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// 5. 注册/切换登录方式
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text(
|
||||
"注册账号",
|
||||
style: TextStyle(color: Color(0xFF576B95)),
|
||||
), // 经典的链接蓝
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
child: VerticalDivider(color: Colors.grey),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text(
|
||||
"验证码登录",
|
||||
style: TextStyle(color: Color(0xFF576B95)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 80),
|
||||
// 6. 底部协议 (社交App必有)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Checkbox(
|
||||
value: true,
|
||||
activeColor: AppColors.primaryColor,
|
||||
onChanged: (v) {},
|
||||
),
|
||||
const Text(
|
||||
"我已阅读并同意",
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
const Text(
|
||||
"《用户协议》",
|
||||
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
|
||||
),
|
||||
const Text(
|
||||
"与",
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
const Text(
|
||||
"《隐私政策》",
|
||||
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
import 'package:app/core/constants/app_colors.dart';
|
||||
import 'package:app/features/auth/pages/login_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoginPageState extends State<LoginPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text("找回密码", style: TextStyle(color: Colors.grey)),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
// 1. 品牌Logo/头像区域
|
||||
Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primaryColor.withOpacity(0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.person_rounded,
|
||||
size: 60,
|
||||
color: AppColors.primaryColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
"登录您的聊天账号",
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
|
||||
// 2. 账号输入框 (极简下划线风格)
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: "账号 / 邮箱 / 手机号",
|
||||
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade300),
|
||||
),
|
||||
focusedBorder: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
|
||||
// 3. 密码输入框
|
||||
TextField(
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: "请输入密码",
|
||||
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade300),
|
||||
),
|
||||
focusedBorder: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
|
||||
// 4. 登录按钮 (圆润大按钮)
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
"登 录",
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// 5. 注册/切换登录方式
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text(
|
||||
"注册账号",
|
||||
style: TextStyle(color: Color(0xFF576B95)),
|
||||
), // 经典的链接蓝
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
child: VerticalDivider(color: Colors.grey),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text(
|
||||
"验证码登录",
|
||||
style: TextStyle(color: Color(0xFF576B95)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 80),
|
||||
// 6. 底部协议 (社交App必有)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Checkbox(
|
||||
value: true,
|
||||
activeColor: AppColors.primaryColor,
|
||||
onChanged: (v) {},
|
||||
),
|
||||
const Text(
|
||||
"我已阅读并同意",
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
const Text(
|
||||
"《用户协议》",
|
||||
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
|
||||
),
|
||||
const Text(
|
||||
"与",
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
const Text(
|
||||
"《隐私政策》",
|
||||
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import 'package:app/features/auth/bloc/login_page_state.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class LoginPage extends StatefulWidget {
|
||||
const LoginPage({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return LoginPageState();
|
||||
}
|
||||
|
||||
import 'package:app/features/auth/bloc/login_page_state.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class LoginPage extends StatefulWidget {
|
||||
const LoginPage({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return LoginPageState();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'package:app/features/home/pages/index_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class IndexPageState extends State<IndexPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text('test');
|
||||
}
|
||||
|
||||
import 'package:app/features/home/pages/index_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class IndexPageState extends State<IndexPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text('test');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
import 'package:app/features/home/pages/main_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MainPageState extends State<MainPage> {
|
||||
|
||||
int count = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(count.toString()),
|
||||
backgroundColor: Colors.blue,
|
||||
),
|
||||
body: widget.child
|
||||
);
|
||||
}
|
||||
|
||||
import 'package:app/features/home/pages/main_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MainPageState extends State<MainPage> {
|
||||
|
||||
int count = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(count.toString()),
|
||||
backgroundColor: Colors.blue,
|
||||
),
|
||||
body: widget.child
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import 'package:app/features/home/bloc/index_page_state.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class IndexPage extends StatefulWidget {
|
||||
const IndexPage({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return IndexPageState();
|
||||
}
|
||||
|
||||
import 'package:app/features/home/bloc/index_page_state.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class IndexPage extends StatefulWidget {
|
||||
const IndexPage({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return IndexPageState();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'package:app/features/home/bloc/main_page_state.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MainPage extends StatefulWidget {
|
||||
final Widget child;
|
||||
const MainPage({super.key,required this.child});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return MainPageState();
|
||||
}
|
||||
|
||||
import 'package:app/features/home/bloc/main_page_state.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MainPage extends StatefulWidget {
|
||||
final Widget child;
|
||||
const MainPage({super.key,required this.child});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return MainPageState();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'package:flutter_web_plugins/url_strategy.dart';
|
||||
import 'package:app/app.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main(List<String> args){
|
||||
|
||||
usePathUrlStrategy();
|
||||
|
||||
runApp(const MyApp());
|
||||
import 'package:flutter_web_plugins/url_strategy.dart';
|
||||
import 'package:app/app.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main(List<String> args){
|
||||
|
||||
usePathUrlStrategy();
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
Reference in New Issue
Block a user