提交 2017cc6f authored 作者: 岳维路's avatar 岳维路

合并分支 'test' 到 'sim'

Test 查看合并请求 kiwitap/zijing-app!3
......@@ -20,12 +20,99 @@ class BuildItem extends StatefulWidget {
class _BuildItemState extends State<BuildItem> {
@override
Widget build(BuildContext context) {
return _buildChapter(widget.model);
// Column(
// children: [
// /// 章节名称容器
// GestureDetector(
// onTap: (){
// widget.onTap(widget.model);
// // // 如果章下面没有节 点击才会跳转
// // if (widget.model.children!.isEmpty){
// // widget.onTap(widget.model);
// // // context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id': widget.model.id.toString(),'chapter_name':widget.model.name.toString()},extra: widget.bookDetails);
// // }
// // setState(() {
// // widget.model.selected = !widget.model.selected;
// // });
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 15.w),
// height: 30.w,
// color: Colors.white,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(widget.model.name??'',style: TextStyle(fontSize: 14.w,color: widget.model.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.medium,height: 2),),
// Gaps.hGaps5,
// widget.model.isReading == 1? Container(
// margin: const EdgeInsets.fromLTRB(0, 6, 0, 0),
// height: 18,
// width: 18,
// alignment: Alignment.center,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8.5.w),
// border: Border.all(width:1,color: AppTheme.primary)
// ),
// child: Text('试',style: TextStyle(fontSize: 11.w,color: AppTheme.primary),),
// ):const SizedBox(),
// ],
// ),
// Transform.rotate(
// angle: widget.model.selected?0:-90 * (3.141592653589793 / 180),
// child: GestureDetector(
// onTap: (){
// setState(() {
// widget.model.selected = !widget.model.selected;
// });
// },
// child: Container(
// width: 20.w,
// height: 20.w,
// // color: Colors.red,
// child: Image.asset('assets/images/down.png')
// ),
// )
// )
//
// ],
// )
// ),
// ),
// /// 节的名称容器
// Visibility(
// visible: widget.model.selected,
// child: ListView.builder(
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// itemBuilder: (BuildContext context, int index){
// ChapterModel model = widget.model.children![index];
// return GestureDetector(
// onTap: (){
// widget.onTap(model);
// // context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id':model.id.toString(),'chapter_name':model.name.toString()},extra: widget.bookDetails);
// },
// child: _buildSection(model)
// );
// },
// itemCount: widget.model.children!.length,
// )
// )
// ],
// );
}
Widget _buildChapter(ChapterModel chapterModel){
return Column(
children: [
/// 章节名称容器
GestureDetector(
onTap: (){
widget.onTap(widget.model);
widget.onTap(chapterModel);
// // 如果章下面没有节 点击才会跳转
// if (widget.model.children!.isEmpty){
// widget.onTap(widget.model);
......@@ -36,75 +123,78 @@ class _BuildItemState extends State<BuildItem> {
// });
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15.w),
height: 30.w,
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(widget.model.name??'',style: TextStyle(fontSize: 14.w,color: widget.model.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.medium,height: 2),),
Gaps.hGaps5,
widget.model.isReading == 1? Container(
margin: const EdgeInsets.fromLTRB(0, 6, 0, 0),
height: 18,
width: 18,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.5.w),
border: Border.all(width:1,color: AppTheme.primary)
),
child: Text('试',style: TextStyle(fontSize: 11.w,color: AppTheme.primary),),
):const SizedBox(),
],
),
Transform.rotate(
angle: widget.model.selected?0:-90 * (3.141592653589793 / 180),
child: GestureDetector(
onTap: (){
setState(() {
widget.model.selected = !widget.model.selected;
});
},
child: Container(
width: 20.w,
height: 20.w,
// color: Colors.red,
child: Image.asset('assets/images/down.png')
),
)
)
padding: EdgeInsets.symmetric(horizontal: 15.w),
height: 30.w,
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(chapterModel.name??'',style: TextStyle(fontSize: 14.w,color: chapterModel.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.medium,height: 2),),
Gaps.hGaps5,
chapterModel.isReading == 1? Container(
margin: const EdgeInsets.fromLTRB(0, 6, 0, 0),
height: 18,
width: 18,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.5.w),
border: Border.all(width:1,color: AppTheme.primary)
),
child: Text('试',style: TextStyle(fontSize: 11.w,color: AppTheme.primary),),
):const SizedBox(),
],
),
Transform.rotate(
angle: chapterModel.selected?0:-90 * (3.141592653589793 / 180),
child: GestureDetector(
onTap: (){
setState(() {
chapterModel.selected = !chapterModel.selected;
});
},
child: Container(
width: 20.w,
height: 20.w,
// color: Colors.red,
child: Image.asset('assets/images/down.png')
),
)
)
],
)
],
)
),
),
/// 节的名称容器
Visibility(
visible: widget.model.selected,
visible: chapterModel.selected,
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index){
ChapterModel model = widget.model.children![index];
return GestureDetector(
onTap: (){
widget.onTap(model);
// context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id':model.id.toString(),'chapter_name':model.name.toString()},extra: widget.bookDetails);
},
child: _buildSection(model)
);
},
itemCount: widget.model.children!.length,
itemBuilder: (BuildContext context, int index){
ChapterModel model = chapterModel.children![index];
return Container(
padding: EdgeInsets.only(left: 60.w,bottom: 4.w),
child: _buildChapter(model)
);
// GestureDetector(
// onTap: (){
// widget.onTap(model);
// // context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id':model.id.toString(),'chapter_name':model.name.toString()},extra: widget.bookDetails);
// },
// child: _buildSection(model)
// );
},
itemCount: chapterModel.children!.length,
)
)
],
);
}
Widget _buildSection(ChapterModel model){
return Container(
color: Colors.white,
......
library image_view;
import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
part 'view.dart';
\ No newline at end of file
part of image_view;
class ImageViewPage extends StatefulWidget {
final List<String>images;
const ImageViewPage({
Key? key,
required this.images
}) : super(key: key);
@override
State<ImageViewPage> createState() => _ImageViewPageState();
}
class _ImageViewPageState extends State<ImageViewPage> {
final List<int> _cachedIndexes = <int>[];
void _preloadImage(int index) {
if (_cachedIndexes.contains(index)) {
return;
}
if (0 <= index && index < widget.images.length) {
final String url = widget.images[index];
precacheImage(ExtendedNetworkImageProvider(url, cache: true), context);
_cachedIndexes.add(index);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
extendBody: true,
body: Container(
color: Colors.black,
child: ExtendedImageGesturePageView.builder(
controller: ExtendedPageController(
initialPage: 0,
pageSpacing: 50,
),
onPageChanged: (int page) {
// _preloadImage(page - 1);
// _preloadImage(page + 1);
},
itemCount: widget.images.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: (){
context.pop();
},
child: ExtendedImage.network(
widget.images[index],
fit: BoxFit.contain,
mode: ExtendedImageMode.gesture,
initGestureConfigHandler: (ExtendedImageState state) {
return GestureConfig(
//you must set inPageView true if you want to use ExtendedImageGesturePageView
inPageView: true,
initialScale: 1.0,
maxScale: 5.0,
animationMaxScale: 6.0,
initialAlignment: InitialAlignment.center,
);
},
),
);
},
),
),
);
}
}
......@@ -5,9 +5,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_book/widgets/index.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:go_router/go_router.dart';
import '../../apis/index.dart';
import '../../models/index.dart';
import '../../routes/index.dart';
import '../../theme.dart';
import '../../utils/index.dart';
import '../read_web/index.dart';
......
......@@ -117,7 +117,12 @@ class _BuildDiscussState extends State<BuildDiscuss> {
type ==0? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(_showText(model),style: TextStyle(fontSize: 13.w,height: 1.5,color: Colours.c3),),
Row(
children: [
Text(_showText(model),style: TextStyle(fontSize: 13.w,height: 1.5,color: Colours.c3),),
Text(_showStatus(model),style: TextStyle(fontSize: 13.w,height: 1.5,color: AppTheme.primary),),
],
),
Gaps.vGaps10,
_buildImageGridView()
],
......@@ -176,20 +181,33 @@ class _BuildDiscussState extends State<BuildDiscuss> {
String _showText(DiscussModel discussModel){
String text = '';
// 是我的
if(discussModel.isMy == 1){
text = '${discussModel.content?.text?.content}';
}
else {
if(discussModel.content?.text?.privacyStatus ==1){
text = '${discussModel.content?.text?.content}';
}
}
return text;
}
String _showStatus(DiscussModel discussModel){
String text = '';
// 是我的
if(discussModel.isMy == 1){
// 审核中
if(discussModel.content?.text?.privacyStatus ==0 ||discussModel.content?.text?.privacyStatus ==2){
text = '${discussModel.content?.text?.content}(审核中)';
text = '(审核中)';
}
// 审核未通过
else if(discussModel.content?.text?.privacyStatus ==-1){
text = '${discussModel.content?.text?.content}(审核未通过)';
text = '(审核未通过)';
}
// 审核通过
else {
text = '${discussModel.content?.text?.content}';
text = '';
}
}
else {
......@@ -203,7 +221,7 @@ class _BuildDiscussState extends State<BuildDiscuss> {
}
// 审核通过
else {
text = '${discussModel.content?.text?.content}';
text = '';
}
}
return text;
......@@ -233,30 +251,36 @@ class _BuildDiscussState extends State<BuildDiscuss> {
),
itemBuilder: (BuildContext context, int index) {
MediaModel? mediaModel = widget.model.content?.image?[index];
return Stack(
children: [
Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: CustomImage.network(url: mediaModel?.content??'',fit: BoxFit.cover,)
),
Visibility(
visible: mediaModel?.privacyStatus == 0?true:false,
child: Positioned(
List<String>images = widget.model.content?.image?.map((MediaModel model) => model.content??'').toList()??[];
return GestureDetector(
onTap: (){
context.pushNamed(Routes.imageView,extra:images);
},
child: Stack(
children: [
Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: Container(
alignment: Alignment.center,
color: widget.model.isMy==1?Colours.c9.withOpacity(0.5):Colours.c9.withOpacity(1),
child: Text('(审核中)',style: TextStyle(fontSize: 11.w,height: 1.5,color: AppTheme.primary),),
)
child: CustomImage.network(url: mediaModel?.content??'',fit: BoxFit.cover,)
),
),
],
Visibility(
visible: mediaModel?.privacyStatus == 0?true:false,
child: Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: Container(
alignment: Alignment.center,
color: widget.model.isMy==1?Colours.c9.withOpacity(0.5):Colours.c9.withOpacity(1),
child: Text('(审核中)',style: TextStyle(fontSize: 11.w,height: 1.5,color: AppTheme.primary),),
)
),
),
],
),
);
// return Container(
// color: Colors.red,
......
......@@ -22,7 +22,7 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
init: UserDiscussDesController(widget.tag,widget.model),
builder: (controller) =>CustomPullScrollView(
controller: controller.refreshController,
// onRefresh: controller.onRefresh,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: ListView.builder(
itemBuilder: (BuildContext context,int index){
......
......@@ -23,6 +23,7 @@ class _BuildListPageState extends State<BuildListPage> with AutomaticKeepAliveCl
builder: (controller) =>CustomPullScrollView(
controller: controller.refreshController,
onLoading: controller.onLoading,
onRefresh: controller.onRefresh,
child: ListView.builder(
itemBuilder: (BuildContext context,int index){
NoteModel model = controller.notes[index];
......
......@@ -72,6 +72,7 @@ class BuildNote extends StatelessWidget {
// color: Colors.red,
color:Colours.c3
),),
Text(_showStatus(model),style: TextStyle(fontSize: 14.w,height: 1.5,color: AppTheme.primary),),
],
),
Gaps.vGaps13,
......@@ -100,20 +101,33 @@ class BuildNote extends StatelessWidget {
String _showText(NoteModel discussModel){
String text = '';
// 是我的
if(discussModel.isMy == 1){
text = '${discussModel.noteContent?.text?.content}';
}
else {
if(discussModel.noteContent?.text?.privacyStatus ==1){
text = '${discussModel.noteContent?.text?.content}';
}
}
return text;
}
String _showStatus(NoteModel discussModel){
String text = '';
// 是我的
if(discussModel.isMy == 1){
// 审核中
if(discussModel.noteContent?.text?.privacyStatus ==0 ||discussModel.noteContent?.text?.privacyStatus ==2){
text = '${discussModel.noteContent?.text?.content}(审核中)';
text = '(审核中)';
}
// 审核未通过
else if(discussModel.noteContent?.text?.privacyStatus ==-1){
text = '${discussModel.noteContent?.text?.content}(审核未通过)';
text = '(审核未通过)';
}
// 审核通过
else {
text = '${discussModel.noteContent?.text?.content}';
text = '';
}
}
else {
......@@ -127,12 +141,11 @@ class BuildNote extends StatelessWidget {
}
// 审核通过
else {
text = '${discussModel.noteContent?.text?.content}';
text = '';
}
}
return text;
}
// 图片
Widget _buildImageGridView(){
return GridView.builder(
......@@ -147,30 +160,36 @@ class BuildNote extends StatelessWidget {
),
itemBuilder: (BuildContext context, int index) {
MediaModel? mediaModel = model.noteContent?.image?[index];
return Stack(
children: [
Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: CustomImage.network(url: mediaModel?.content??'',fit: BoxFit.cover,)
),
Visibility(
visible: mediaModel?.privacyStatus == 0?true:false,
child: Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: Container(
alignment: Alignment.center,
color: model.isMy==1?Colours.c9.withOpacity(0.5):Colours.c9.withOpacity(1),
child: Text('(审核中)',style: TextStyle(fontSize: 14.w,height: 1.5,color: AppTheme.primary),),
)
List<String>images = model.noteContent?.image?.map((MediaModel model) => model.content??'').toList()??[];
return GestureDetector(
onTap: (){
context.pushNamed(Routes.imageView,extra:images);
},
child: Stack(
children: [
Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: CustomImage.network(url: mediaModel?.content??'',fit: BoxFit.cover,)
),
),
],
Visibility(
visible: mediaModel?.privacyStatus == 0?true:false,
child: Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: Container(
alignment: Alignment.center,
color: model.isMy==1?Colours.c9.withOpacity(0.5):Colours.c9.withOpacity(1),
child: Text('(审核中)',style: TextStyle(fontSize: 14.w,height: 1.5,color: AppTheme.primary),),
)
),
),
],
),
);
},
itemCount: model.noteContent?.image?.length,
......
......@@ -57,7 +57,7 @@ class UserOrderAwaitingController extends GetxController {
orderAwaitings = [
OrderCompletedModel(name: '订单编号',value: model.ordersnum.toString()),
OrderCompletedModel(name: '支付方式',value: payWay),
OrderCompletedModel(name: '支付时间',value: model.payTime.toString()),
OrderCompletedModel(name: '下单时间',value: model.createTime.toString()),
];
update();
......
......@@ -38,7 +38,7 @@ class UserOrderCancelDetailController extends GetxController {
double.parse(model.finalTotalPrice.toString())).toString()),
OrderCompletedModel(name: '订单编号',value: model.ordersnum.toString()),
OrderCompletedModel(name: '支付方式',value: payWay),
OrderCompletedModel(name: '支付时间',value: model.payTime.toString()),
// OrderCompletedModel(name: '支付时间',value: model.payTime.toString()),
OrderCompletedModel(name: '下单时间',value: model.createTime.toString()),
// OrderCompletedModel(name: '退款时间',value: model.refundTime.toString()),
];
......
......@@ -119,7 +119,7 @@ class UserOrderCoinAwaitingController extends GetxController {
orderAwaitings = [
OrderCompletedModel(name: '订单编号',value: model.ordersnum.toString()),
OrderCompletedModel(name: '支付方式',value: payWay),
OrderCompletedModel(name: '支付时间',value: model.payTime.toString()),
OrderCompletedModel(name: '下单时间',value: model.createTime.toString()),
];
data.add(CoinModel(identifying:model.goodsId));
......
......@@ -2,6 +2,7 @@ library routes;
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_book/pages/ad/index.dart';
import 'package:flutter_book/pages/answer/index.dart';
import 'package:flutter_book/pages/book_detail/index.dart';
......@@ -52,6 +53,7 @@ import '../models/index.dart';
import '../pages/ad_detail/index.dart';
import '../pages/bai_dict/index.dart';
import '../pages/bai_ke/index.dart';
import '../pages/image_view/index.dart';
import '../pages/read_web/index.dart';
import '../pages/user_edit_note/index.dart';
import '../pages/user_order/index.dart';
......@@ -65,4 +67,5 @@ import '../store/index.dart';
part 'observers.dart';
part 'routes.dart';
\ No newline at end of file
part 'routes.dart';
part 'transitions.dart';
\ No newline at end of file
......@@ -130,6 +130,8 @@ abstract class Routes {
static const orderRefunded= 'order_refunded';
// 搜索订单
static const orderSearch= 'order_search';
// 图片预览
static const imageView = 'image_view';
......@@ -689,6 +691,18 @@ abstract class Routes {
)
)
),
GoRoute( // 知识测评
path: '/$imageView',
name: imageView,
pageBuilder: (context, state) =>BottomToTopTransitionPage(
name: state.uri.toString(),
key: state.pageKey,
child: ImageViewPage(
images: state.extra as List<String>,
)
)
),
]
);
......
/// @Description: 路由动画
/// @Author: 歪脖子
/// @Date: 2023-10-13 13:05
part of routes;
class BottomToTopTransitionPage<T> extends CustomTransitionPage<T> {
BottomToTopTransitionPage({
super.key,
super.name,
required super.child,
}) : super(
opaque: true,
barrierColor: Colors.black,
barrierDismissible: true,
fullscreenDialog: true,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return SlideTransition(
position: CurveTween(curve: Curves.fastOutSlowIn)
.animate(animation)
.drive<Offset>(
Tween(begin: const Offset(0, 1.0), end: Offset.zero),
),
child: SafeArea(
bottom: false,
child: Material(
type: MaterialType.transparency,
// clipBehavior: Clip.hardEdge,
// shape: Theme.of(context).bottomSheetTheme.shape,
child: MediaQuery.removePadding(
context: context,
// removeTop: true,
// removeLeft: true,
// removeRight: true,
child: child,
),
),
),
);
},
);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论