提交 f549e23b authored 作者: yueweilu's avatar yueweilu

add

上级 6554650c
part of library;
\ No newline at end of file
library library;
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:ionicons/ionicons.dart';
import '../study/index.dart';
part 'view.dart';
part 'controller.dart';
part 'widgets/cell.dart';
\ No newline at end of file
part of library;
class LibraryPage extends StatefulWidget {
const LibraryPage({Key? key}) : super(key: key);
@override
State<LibraryPage> createState() => _LibraryPageState();
}
class _LibraryPageState extends State<LibraryPage> with AutomaticKeepAliveClientMixin,SingleTickerProviderStateMixin{
List<String> _tabTag = ['全部','职业证书','人文艺术','财经管理'];
List<Tab> get _tabs {
return _tabTag.map<Tab>((item) => Tab(text: item,)).toList();
}
@override
void initState() {
_tabController = TabController(length:4, vsync: this);
super.initState();
}
late TabController _tabController;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Container(
color: Colors.limeAccent,
height: 40,
),
// leading: TextField(
//
// style: TextStyle(
// color: Colors.cyan
// ),
// decoration: InputDecoration(
// hintText: '请输入手机号',
// prefixIcon: Icon(Icons.search),
// border:InputBorder.none,
// enabledBorder: InputBorder.none,
// focusedBorder: InputBorder.none
// // contentPadding: EdgeInsets.symmetric(vertical: 16.0),
// ),
// ),
actions: [
IconButton(
color: Colors.cyan,
icon: const Icon(Icons.message),
tooltip: 'Open shopping cart',
onPressed: () {
},
),
IconButton(
color: Colors.cyan,
icon: const Icon(Icons.refresh),
tooltip: 'Open shopping cart',
onPressed: () {
},
),
],
),
body: Container(
margin: EdgeInsets.all(10),
child: SingleChildScrollView(
child: Column(
children: [
Container(
color: Colors.cyan,
height: 150,
margin: EdgeInsets.only(bottom: 10),
),
HomeCard(title: '人气推荐1',),
HomeCard(title: '人气推荐2',),
HomeCard(title: '人气推荐3',),
HomeCard(title: '人气推荐4',)
],
)
),
),
);
}
/// 列表
Widget createListView(){
return ListView.builder(
itemBuilder: (BuildContext context, int index){
return LibraryCell();
},
itemCount: 2,
);
}
/// 分类
Widget scaffold (){
return Scaffold(
appBar: AppBar(
title: const Text('图书馆',style: TextStyle(
color: Colors.white
),),
flexibleSpace: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFFEE5982),Color(0xFFAB1941)]
)
),
),
actions: [
IconButton(
color: Colors.white,
icon: const Icon(Icons.search),
tooltip: 'Open shopping cart',
onPressed: () {
},
),
],
bottom: PreferredSize(
preferredSize: Size.fromHeight(48),
child: Container(
color: Colors.white,
width: double.infinity,
child: Row(
children: [
Expanded(
child: TabBar(
indicator: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.transparent, width: 0.0)), // 将指示器的底边框颜色设置为透明
color: Colors.lightBlue
),
unselectedLabelColor: Colors.grey,
controller: _tabController,
// isScrollable: true,
tabs: [
Tab(text: '全部'),
Tab(text: '职业证书'),
Tab(text: '人文艺术'),
Tab(text: '财经管理'),
// Tab(text: '待评价'),
// Tab(text: '待评价1'),
// Tab(text: '待评价2'),
],
),
),
GestureDetector(
child: Container(
child: Text('分类'),
),
)
],
),
),
),
),
body: TabBarView(
controller: _tabController,
children: [
// 第一个分类的内容
LibraryCell(),
// 第二个分类的内容
Center(child: Text('分类2内容')),
// 第三个分类的内容
Center(child: Text('分类3内容')),
Center(child: Text('分类4内容')),
// Center(child: Text('分类5内容')),
// Center(child: Text('分类5内容')),
// Center(child: Text('分类5内容')),
],
),
);
}
@override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true;
}
part of library;
class LibraryCell extends StatefulWidget {
const LibraryCell({Key? key}) : super(key: key);
@override
State<LibraryCell> createState() => _LibraryCellState();
}
class _LibraryCellState extends State<LibraryCell> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: 10,top: 20,bottom: 20),
margin: EdgeInsets.only(top:10,left: 10,right: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5), // 阴影颜色
spreadRadius: 2, // 阴影扩散半径
blurRadius: 5, // 阴影模糊半径
offset: Offset(0, 2), // 阴影偏移
),
],
),
// height: 200,
// color: Colors.cyanAccent,
child: Row(
children: [
/// 左侧
Container(
width: 60,
height: 80,
color: Colors.cyan,
),
/// 右侧
Expanded(
child: Container(
margin: const EdgeInsets.only(left: 10,right: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 10,),
Text('标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题',overflow: TextOverflow.ellipsis,maxLines: 1,),
SizedBox(height: 10,),
Text('描述描述描述描述描述描述描述描述描述'),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text('88'),
SizedBox(width: 10,),
Text('108',style: TextStyle(
decoration: TextDecoration.combine([
TextDecoration.lineThrough
]),
decorationColor: Colors.red
),),
],
),
Text('103万人读过')
],
)
],
),
),
)
],
),
);
}
}
......@@ -30,17 +30,26 @@ class LoginPage extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
TextField(
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
// color: Colors.red,
border: Border.all(width: 1,color: Colors.red),
),
child: TextField(
style: TextStyle(
color: Colors.cyan
),
decoration: InputDecoration(
hintText: '请输入手机号',
prefixIcon: Icon(Ionicons.phone_portrait),
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red, width: 10.w),
borderRadius: BorderRadius.all(Radius.circular(25.w)),
),
border:InputBorder.none,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none
// contentPadding: EdgeInsets.symmetric(vertical: 16.0),
),
),
),
SizedBox(height: 30.w,),
TextField(
decoration: const InputDecoration(hintText: '获取验证码'),
......
......@@ -2,6 +2,7 @@ library main;
import 'package:flutter/material.dart';
import 'package:flutter_book/pages/home/index.dart';
import 'package:flutter_book/pages/library/index.dart';
import 'package:flutter_book/theme.dart';
import 'package:get/get.dart';
import 'package:ionicons/ionicons.dart';
......
......@@ -40,6 +40,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver{
onPageChanged: controller.onPageChanged,
children: const [
WebPage(),
LibraryPage(),
TestTTSPage(),
RecordPage(),
HomePage(),
......@@ -56,17 +57,22 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver{
BottomNavigationBarItem(
icon: Icon(Ionicons.home_outline),
activeIcon:Icon(Ionicons.home),
label: '首页',
label: '发现',
),
BottomNavigationBarItem(
icon: Icon(Ionicons.apps_outline),
activeIcon:Icon(Ionicons.apps),
icon: Icon(Ionicons.bookmarks),
activeIcon:Icon(Ionicons.book_outline),
label: '图书馆',
),
BottomNavigationBarItem(
icon: Icon(Ionicons.chatbubbles_outline),
activeIcon:Icon(Ionicons.chatbubbles),
label: '购物车',
label: '书架',
),
BottomNavigationBarItem(
icon: Icon(Ionicons.person_outline),
activeIcon:Icon(Ionicons.person),
label: '课程',
),
BottomNavigationBarItem(
icon: Icon(Ionicons.person_outline),
......
part of study;
class HomeCard extends StatelessWidget {
final String? title;
const HomeCard({
super.key,
this.title,
});
@override
Widget build(BuildContext context) {
return Container(
// margin:EdgeInsets.only(left: 10,right: 10,top: 100,bottom: 100),
// height: 100,
// margin: const EdgeInsets.fromLTRB(10, 10, 10,0),
color: Colors.yellow,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Container(
height: 40,
color: Colors.red,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title.toString()),
Row(
children: [
const Text('查看全部'),
SizedBox(width: 10,),
Container(
height: 10,
width: 4,
color: Colors.cyan,
)
],
)
],
),
),
Container(
margin: EdgeInsets.all(10),
color: Colors.blueAccent,
// color: Colors.cyan,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 160,
width: 100,
color: Colors.cyan,
),
Expanded(
child: Container(
color: Colors.red,
margin: EdgeInsets.all(10),
child: const Column(
crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Text('名称',textAlign: TextAlign.start,),
SizedBox(height: 20,),
Text(
'描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述',
maxLines: 3,
overflow: TextOverflow.ellipsis,
)
],
),
),
)
],
),
),
],
),
);
}
}
library study;
import 'package:flutter/material.dart';
part 'home_card.dart';
\ No newline at end of file
......@@ -10,7 +10,8 @@ abstract class Routes {
static const login = 'login';
static final GoRouter config = GoRouter(
initialLocation: '/$splash',
// initialLocation: '/$splash',
initialLocation: '/',
observers: [observer],
routes: [
GoRoute(
......
......@@ -156,12 +156,12 @@ abstract class AppTheme {
fontWeight: FontWeight.w600,
height: 1.2,
),
toolbarTextStyle: TextStyle(
color: scheme.onBackground,
fontSize: 22.w,
fontWeight: FontWeight.w600,
height: 1.2,
),
// toolbarTextStyle: TextStyle(
// color: scheme.onBackground,
// fontSize: 22.w,
// fontWeight: FontWeight.w600,
// height: 1.2,
// ),
),
textTheme: TextTheme(
bodyMedium: TextStyle(
......@@ -175,10 +175,10 @@ abstract class AppTheme {
color: scheme.onBackground,
),
),
bottomAppBarTheme: BottomAppBarTheme(
elevation: 0,
color: scheme.background,
),
// bottomAppBarTheme: BottomAppBarTheme(
// elevation: 0,
// color: scheme.background,
// ),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
type: BottomNavigationBarType.fixed,
elevation: 0,
......
......@@ -53,6 +53,9 @@ dependencies:
flutter_inappwebview: ^5.6.0
intl: 0.18.0
flutter_sound: ^9.2.13
permission_handler: 11.0.1
dev_dependencies:
flutter_test:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论