初始化
This commit is contained in:
36
lib/pages/student/home/s_home_page.dart
Normal file
36
lib/pages/student/home/s_home_page.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'today/s_today_card.dart';
|
||||
import 'widgets/user_header.dart';
|
||||
|
||||
class SHomePage extends StatefulWidget {
|
||||
const SHomePage({super.key});
|
||||
|
||||
@override
|
||||
State<SHomePage> createState() => _SHomePageState();
|
||||
}
|
||||
|
||||
class _SHomePageState extends State<SHomePage> {
|
||||
///刷新状态
|
||||
Future<void> _refresh() async {
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
appBar: UserHeader(),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: _refresh,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(context.pagePadding),
|
||||
children: [
|
||||
STodayCard(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
85
lib/pages/student/home/today/banner_info.dart
Normal file
85
lib/pages/student/home/today/banner_info.dart
Normal file
@@ -0,0 +1,85 @@
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
///banner
|
||||
class BannerInfo extends StatelessWidget {
|
||||
const BannerInfo({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: Image.network(
|
||||
"https://images.unsplash.com/photo-1505209487757-5114235191e5?w=800",
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context).primaryColor,
|
||||
Theme.of(context).primaryColor.withValues(alpha: 0.5),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(context.pagePadding),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
margin: EdgeInsets.only(bottom: 30),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black26,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: 5,
|
||||
children: [
|
||||
Container(
|
||||
width: 15,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
color: context.success,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"进行中",
|
||||
style: TextStyle(color: Colors.white, fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"高中数学专场",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"专业老师在线陪伴,专注高效学习",
|
||||
style: TextStyle(color: Colors.white70, fontSize: 14),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
127
lib/pages/student/home/today/s_today_card.dart
Normal file
127
lib/pages/student/home/today/s_today_card.dart
Normal file
@@ -0,0 +1,127 @@
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/router/route_paths.dart';
|
||||
import 'package:app/widgets/base/button/index.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
import 'banner_info.dart';
|
||||
import 'teacher_info.dart';
|
||||
|
||||
class STodayCard extends StatefulWidget {
|
||||
const STodayCard({super.key});
|
||||
|
||||
@override
|
||||
State<STodayCard> createState() => _STodayCardState();
|
||||
}
|
||||
|
||||
class _STodayCardState extends State<STodayCard> {
|
||||
|
||||
///进入自习室
|
||||
void _handleEnterRoom() {
|
||||
context.push(RoutePaths.sRoom);
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BannerInfo(),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(horizontal: context.pagePadding, vertical: 20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
spacing: 30,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TeacherInfo(),
|
||||
Row(
|
||||
spacing: 20,
|
||||
children: [
|
||||
InfoItem(
|
||||
label: "自习时间",
|
||||
value: "19:00-21:00",
|
||||
icon: RemixIcons.time_line,
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
InfoItem(
|
||||
label: "在线人数",
|
||||
value: "8/12 人",
|
||||
icon: RemixIcons.time_line,
|
||||
color: context.success,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
child: Button(
|
||||
text: "进入自习室",
|
||||
onPressed: _handleEnterRoom,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
///信息item
|
||||
class InfoItem extends StatelessWidget {
|
||||
final String label;
|
||||
final String value;
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
|
||||
const InfoItem({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.value,
|
||||
required this.icon,
|
||||
required this.color,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(context.pagePadding),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: color.withValues(alpha: 0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(icon, color: color),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label, style: Theme.of(context).textTheme.labelMedium),
|
||||
Text(value, style: TextStyle(fontSize: 16)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
54
lib/pages/student/home/today/teacher_info.dart
Normal file
54
lib/pages/student/home/today/teacher_info.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
//老师信息
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TeacherInfo extends StatelessWidget {
|
||||
const TeacherInfo({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(context.pagePadding),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffeef2ff),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
spacing: 15,
|
||||
children: [
|
||||
Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
width: 3,
|
||||
),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: 'https://doaf.asia/api/assets/1/图/62865798_p0.jpg',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("张老师"),
|
||||
Text(
|
||||
"资深数学教师 · 10年教学经验",
|
||||
style: Theme.of(context).textTheme.labelLarge,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
52
lib/pages/student/home/widgets/feature_static.dart
Normal file
52
lib/pages/student/home/widgets/feature_static.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
class FeatureStatic extends StatelessWidget {
|
||||
const FeatureStatic({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<FeatureItem> items = [
|
||||
FeatureItem("视频陪学", "老师全程在线监督", RemixIcons.video_on_ai_line),
|
||||
FeatureItem("举手提问", "实时互动解答疑惑", RemixIcons.hand),
|
||||
FeatureItem("拍照题目", "快速上传问题截图", RemixIcons.camera_2_line),
|
||||
FeatureItem("文件共享", "支持PDF等多种格式", RemixIcons.upload_2_line),
|
||||
];
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 15,
|
||||
children: [
|
||||
Text("核心功能", style: TextStyle(fontSize: 18)),
|
||||
GridView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
mainAxisSpacing: 15,
|
||||
crossAxisSpacing: 15,
|
||||
mainAxisExtent: 120
|
||||
),
|
||||
itemBuilder: (_, index) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: items.length,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class FeatureItem {
|
||||
final String title;
|
||||
final String desc;
|
||||
final IconData icon;
|
||||
|
||||
FeatureItem(this.title, this.desc, this.icon);
|
||||
}
|
||||
44
lib/pages/student/home/widgets/user_header.dart
Normal file
44
lib/pages/student/home/widgets/user_header.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
class UserHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
const UserHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
title: const Text('学光自习室'),
|
||||
actions: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xffffb900), Color(0xffff8904)],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
spacing: 5,
|
||||
children: [
|
||||
const Icon(
|
||||
RemixIcons.vip_crown_line,
|
||||
color: Colors.white,
|
||||
size: 18,
|
||||
),
|
||||
Text(
|
||||
"会员至 2025-03-12",
|
||||
style: TextStyle(color: Colors.white, fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||
}
|
||||
Reference in New Issue
Block a user