初始化

This commit is contained in:
zhutao
2025-11-19 17:56:39 +08:00
commit 1b28239352
115 changed files with 5440 additions and 0 deletions

View 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(),
],
),
),
);
}
}

View 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),
),
),
],
),
),
],
);
}
}

View 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)),
],
),
],
),
),
);
}
}

View 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,
),
],
),
],
),
);
}
}

View 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);
}

View 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);
}

View File

@@ -0,0 +1,92 @@
import 'package:app/widgets/room/file_drawer.dart';
import 'package:flutter/material.dart';
import 'package:remixicon/remixicon.dart';
class BottomBar extends StatefulWidget {
const BottomBar({super.key});
@override
State<BottomBar> createState() => _BottomBarState();
}
class _BottomBarState extends State<BottomBar> {
///显示文件
void _handShowFile() {
showFileDialog(context);
}
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Color(0xff232426),
),
height: 70,
child: Row(
children: [
BarItem(
title: "摄像头",
icon: RemixIcons.video_on_fill,
),
BarItem(
title: "麦克风",
icon: RemixIcons.mic_off_fill,
),
BarItem(
title: "已静音",
icon: RemixIcons.volume_mute_fill,
isOff: true,
),
BarItem(
title: "举手",
icon: RemixIcons.hand,
),
BarItem(
title: "拍照",
icon: RemixIcons.upload_2_fill,
onTap: _handShowFile,
),
],
),
);
}
}
class BarItem extends StatelessWidget {
final String title;
final IconData icon;
final bool isOff;
final void Function()? onTap;
const BarItem({
super.key,
required this.title,
required this.icon,
this.isOff = false,
this.onTap,
});
@override
Widget build(BuildContext context) {
return Expanded(
child: InkWell(
onTap: onTap,
child: Container(
color: isOff ? Colors.red : null,
child: Column(
spacing: 3,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, color: Colors.white),
Text(
title,
style: TextStyle(color: Colors.white70, fontSize: 12),
),
],
),
),
),
);
}
}

View File

@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
import 'package:remixicon/remixicon.dart';
class TopBar extends StatelessWidget implements PreferredSizeWidget {
final bool showOther;
final void Function()? onOther;
const TopBar({super.key, this.showOther = false, this.onOther});
@override
Widget build(BuildContext context) {
return AppBar(
foregroundColor: Colors.white,
titleTextStyle: TextStyle(color: Colors.white, fontSize: 18),
backgroundColor: Color(0xff232426),
centerTitle: true,
title: Column(
children: [
Text("会议"),
Text(
"01:12",
style: TextStyle(fontSize: 12, color: Colors.white24),
),
],
),
actions: [
IconButton(
onPressed: onOther,
icon: Icon(showOther ? RemixIcons.team_fill : RemixIcons.team_line),
),
],
);
}
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}

View File

@@ -0,0 +1,86 @@
import 'package:app/widgets/base/transition/slide_hide.dart';
import 'package:flutter/material.dart';
import 'controls/bottom_bar.dart';
import 'controls/top_bar.dart';
import 'video/student_video_list.dart';
import 'video/teacher_video.dart';
class SRoomPage extends StatefulWidget {
const SRoomPage({super.key});
@override
State<SRoomPage> createState() => _SRoomPageState();
}
class _SRoomPageState extends State<SRoomPage> {
/// 显示控制栏
bool _controlsVisible = true;
///显示其他学生画面
bool _showOtherStudent = true;
///切换显示控制栏
void _toggleOverlay() {
setState(() {
_controlsVisible = !_controlsVisible;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
//底部控制显示
GestureDetector(
onTap: _toggleOverlay,
child: Container(color: Color(0xff2c3032)),
),
//老师视频画面
TeacherVideo(),
Positioned(
right: 0,
top: 0,
bottom: 0,
child: Visibility(
visible: _showOtherStudent,
child: StudentVideoList(),
),
),
///控制栏
Positioned(
top: 0,
left: 0,
right: 0,
child: SlideHide(
direction: SlideDirection.up,
hide: !_controlsVisible,
child: TopBar(
showOther: _showOtherStudent,
onOther: () {
setState(() {
_showOtherStudent = !_showOtherStudent;
});
},
),
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: SlideHide(
direction: SlideDirection.down,
hide: !_controlsVisible,
child: BottomBar(),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,64 @@
import 'package:flutter/material.dart';
class StudentVideoList extends StatefulWidget {
const StudentVideoList({super.key});
@override
State<StudentVideoList> createState() => _StudentVideoListState();
}
class _StudentVideoListState extends State<StudentVideoList> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Container(
width: 250,
padding: EdgeInsets.only(bottom: 30),
child: ListView.separated(
padding: EdgeInsets.all(10),
itemCount: 8,
itemBuilder: (context, index) {
return VideoItem();
},
separatorBuilder: (context, index) => SizedBox(height: 15),
),
),
);
}
}
class VideoItem extends StatelessWidget {
const VideoItem({super.key});
@override
Widget build(BuildContext context) {
return Stack(
children: [
AspectRatio(
aspectRatio: 1.5 / 1,
child: Container(
decoration: BoxDecoration(
color: Color(0xff373c3e),
borderRadius: BorderRadius.circular(10),
),
),
),
Positioned(
bottom: 5,
left: 5,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 7, vertical: 3),
decoration: BoxDecoration(
color: Colors.black26,
borderRadius: BorderRadius.circular(5),
),
child: Text(
"小红",
style: TextStyle(fontSize: 12, color: Colors.white),
),
),
),
],
);
}
}

View File

@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
class TeacherVideo extends StatefulWidget {
const TeacherVideo({super.key});
@override
State<TeacherVideo> createState() => _TeacherVideoState();
}
class _TeacherVideoState extends State<TeacherVideo> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Align(
child: Text(
"画面准备中",
style: TextStyle(color: Colors.white),
),
),
);
}
}