提交 0f3d3747 authored 作者: 岳维路's avatar 岳维路

合并分支 'test' 到 'sim'

Test 查看合并请求 kiwitap/zijing-app!16
...@@ -17,7 +17,7 @@ class _BaiKePageState extends State<BaiKePage> { ...@@ -17,7 +17,7 @@ class _BaiKePageState extends State<BaiKePage> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: false, centerTitle: false,
title: Text('${widget.keyword}百度百科',style: TextStyle(fontSize: 14.w,fontWeight: Fonts.medium,color: Colours.c3),), title: Text(widget.keyword,style: TextStyle(fontSize: 14.w,fontWeight: Fonts.medium,color: Colours.c3),),
), ),
body: InAppWebView( body: InAppWebView(
initialUrlRequest: URLRequest( initialUrlRequest: URLRequest(
......
...@@ -117,6 +117,7 @@ class LoginController extends GetxController { ...@@ -117,6 +117,7 @@ class LoginController extends GetxController {
/// 登录 /// 登录
void onLogin(BuildContext context) async { void onLogin(BuildContext context) async {
Tools.unfocus();
if (!agree) { if (!agree) {
Toast.show('请先阅读并同意《用户协议》和《隐私政策》'); Toast.show('请先阅读并同意《用户协议》和《隐私政策》');
return; return;
......
...@@ -49,7 +49,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -49,7 +49,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
bool get show => _show; bool get show => _show;
// 录音 // 录音
final FlutterSoundRecorder _mRecorder = FlutterSoundRecorder(logLevel:Level.error); FlutterSoundRecorder _mRecorder = FlutterSoundRecorder(logLevel:Level.error);
// 录音开始 // 录音开始
bool startRecording = false; bool startRecording = false;
// 是否存在离线文件 // 是否存在离线文件
...@@ -90,6 +90,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -90,6 +90,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
///------------------------------------------ 页面 生命周期-------------------------------------------------------- ///------------------------------------------ 页面 生命周期--------------------------------------------------------
@override @override
void onInit() async { void onInit() async {
...@@ -136,6 +137,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -136,6 +137,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
contentInput.dispose(); contentInput.dispose();
flutterTts.stop(); flutterTts.stop();
searchInput.dispose(); searchInput.dispose();
if (_mRecorder != null) {
_mRecorder.closeRecorder();
}
// 关闭防截屏 // 关闭防截屏
// await ScreenProtector.preventScreenshotOff(); // await ScreenProtector.preventScreenshotOff();
super.onClose(); super.onClose();
...@@ -153,6 +157,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -153,6 +157,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
model.selected = !model.selected; model.selected = !model.selected;
} }
} }
setShowSearch(false);
searchInput.text = '';
toolModel = selectedModel; toolModel = selectedModel;
update(); update();
} }
...@@ -306,14 +312,13 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -306,14 +312,13 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 开启录音 // 开启录音
void record() async { void record() async {
openTheRecorder(); openTheRecorder();
update();
startRecording = true; startRecording = true;
String filePath = await Tools.getDirectory(); String filePath = await Tools.getDirectory();
String fileName = Tools.generateVoiceFileName(); String fileName = Tools.generateVoiceFileName();
Console.log('record---------------------$filePath/$fileName'); String recordePath = '$filePath/$fileName';
Console.log('record---------------------$recordePath');
_mRecorder.startRecorder( _mRecorder.startRecorder(
toFile: '$filePath/$fileName', toFile: recordePath,
audioSource: AudioSource.microphone, audioSource: AudioSource.microphone,
codec: Codec.aacMP4, codec: Codec.aacMP4,
...@@ -334,11 +339,14 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -334,11 +339,14 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
startRecording = false; startRecording = false;
final path = await _mRecorder.stopRecorder(); final path = await _mRecorder.stopRecorder();
Console.log('stopRecorder-----------path---------------------$path'); Console.log('stopRecorder-----------path---------------------$path');
var duration = await audioPlayer.setFilePath(path!); if(path!=null && path.isNotEmpty){
Console.log('-----duration---------------------$duration------'); var duration = await audioPlayer.setFilePath(path!);
AudioModel audioModel = AudioModel(path: path,duration: Tools.formatDuration(duration!),currentDuration: '0:00:00'); Console.log('-----duration---------------------$duration------');
if(audioModel.duration !='0:00:00'){ AudioModel audioModel = AudioModel(path: path!,duration: Tools.formatDuration(duration!),currentDuration: '0:00:00');
discussInputAudios.add(audioModel); if(audioModel.duration !='0:00:00'){
discussInputAudios.add(audioModel);
}
} }
update(); update();
} }
......
...@@ -87,18 +87,21 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> { ...@@ -87,18 +87,21 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
], ],
), ),
widget.controller.showSearch? Expanded( widget.controller.showSearch? Expanded(
child: CustomPullScrollView( child: Container(
controller: widget.controller.refreshController, margin: EdgeInsets.only(top: 15.w),
onRefresh: widget.controller.onRefreshSearch, child: CustomPullScrollView(
onLoading: widget.controller.onLoadingSearch, controller: widget.controller.refreshController,
child: BuildSearchAll( onRefresh: widget.controller.onRefreshSearch,
onTap: (SearchAllModel sModel){ onLoading: widget.controller.onLoadingSearch,
if (widget.onTapSearchItem !=null) { child: BuildSearchAll(
widget.onTapSearchItem!(sModel); onTap: (SearchAllModel sModel){
} if (widget.onTapSearchItem !=null) {
}, widget.onTapSearchItem!(sModel);
searchALlResults: widget.controller.searchALlResults }
,), },
searchALlResults: widget.controller.searchALlResults
,),
),
)): )):
widget.controller.showSearch?const SizedBox():BuildBook(bookDetailModel: widget.controller.bookDetailModel,), widget.controller.showSearch?const SizedBox():BuildBook(bookDetailModel: widget.controller.bookDetailModel,),
widget.controller.showSearch?const SizedBox():Expanded( widget.controller.showSearch?const SizedBox():Expanded(
......
...@@ -88,17 +88,20 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> { ...@@ -88,17 +88,20 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
], ],
), ),
controller.showSearch? Expanded( controller.showSearch? Expanded(
child: CustomPullScrollView( child: Container(
controller: controller.refreshController, margin: EdgeInsets.only(top: 15.w),
onRefresh: controller.onRefreshSearch, child: CustomPullScrollView(
onLoading: controller.onLoadingSearch, controller: controller.refreshController,
child: BuildSearchAll( onRefresh: controller.onRefreshSearch,
onTap: (SearchAllModel sModel){ onLoading: controller.onLoadingSearch,
if (widget.onTapSearchItem !=null) { child: BuildSearchAll(
widget.onTapSearchItem!(sModel); onTap: (SearchAllModel sModel){
} if (widget.onTapSearchItem !=null) {
}, widget.onTapSearchItem!(sModel);
searchALlResults: controller.searchALlResults, }
},
searchALlResults: controller.searchALlResults,
),
), ),
)): )):
Expanded(child: Stack( Expanded(child: Stack(
...@@ -130,12 +133,13 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> { ...@@ -130,12 +133,13 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
Visibility( Visibility(
visible: controller.showReply, visible: controller.showReply,
child: Positioned( child: Positioned(
bottom:-69, bottom:-69.w,
left: 0, left: 0,
right: 0, right: 0,
top: 0, top: 0,
child: GestureDetector( child: GestureDetector(
onTap: (){ onTap: (){
Tools.unfocus();
controller.setShow(); controller.setShow();
}, },
child: Container( child: Container(
......
...@@ -198,7 +198,7 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> { ...@@ -198,7 +198,7 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
); );
widget.controller.addDiscussInputImages(assets!.path); widget.controller.addDiscussInputImages(assets!.path);
}, },
child: Container( child: SizedBox(
// color: Colors.red, // color: Colors.red,
width: 25, width: 25,
height: 25, height: 25,
...@@ -215,7 +215,7 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> { ...@@ -215,7 +215,7 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
} }
}, },
child: Container( child: SizedBox(
// color: Colors.red, // color: Colors.red,
width: 23, width: 23,
height: 23, height: 23,
......
...@@ -88,17 +88,20 @@ class _ReadNotePageState extends State<ReadNotePage> { ...@@ -88,17 +88,20 @@ class _ReadNotePageState extends State<ReadNotePage> {
], ],
), ),
controller.showSearch? Expanded( controller.showSearch? Expanded(
child: CustomPullScrollView( child: Container(
controller: controller.refreshController, margin: EdgeInsets.only(top: 15.w),
onRefresh: controller.onRefreshSearch, child: CustomPullScrollView(
onLoading: controller.onLoadingSearch, controller: controller.refreshController,
child: BuildSearchAll( onRefresh: controller.onRefreshSearch,
onTap: (SearchAllModel sModel){ onLoading: controller.onLoadingSearch,
if (widget.onTapSearchItem !=null) { child: BuildSearchAll(
widget.onTapSearchItem!(sModel); onTap: (SearchAllModel sModel){
} if (widget.onTapSearchItem !=null) {
}, widget.onTapSearchItem!(sModel);
searchALlResults: controller.searchALlResults }
},
searchALlResults: controller.searchALlResults
),
), ),
)): )):
controller.showSearch?const SizedBox():BuildBook(bookDetailModel: widget.bookDetailModel,), controller.showSearch?const SizedBox():BuildBook(bookDetailModel: widget.bookDetailModel,),
......
...@@ -34,6 +34,7 @@ class UserEditNoteController extends GetxController { ...@@ -34,6 +34,7 @@ class UserEditNoteController extends GetxController {
void onClose() { void onClose() {
contentInput.dispose(); contentInput.dispose();
audioPlayer.dispose(); audioPlayer.dispose();
Tools.unfocus();
super.onClose(); super.onClose();
} }
...@@ -186,6 +187,7 @@ class UserEditNoteController extends GetxController { ...@@ -186,6 +187,7 @@ class UserEditNoteController extends GetxController {
// 提交 // 提交
Future<bool> submit() async { Future<bool> submit() async {
CustomToast.loading();
// 循环上传图片获取地址 // 循环上传图片获取地址
for(MediaModel mediaModel in model.noteContent!.image!){ for(MediaModel mediaModel in model.noteContent!.image!){
if (mediaModel.id == 0){ if (mediaModel.id == 0){
...@@ -201,6 +203,7 @@ class UserEditNoteController extends GetxController { ...@@ -201,6 +203,7 @@ class UserEditNoteController extends GetxController {
mediaModel.content = url; mediaModel.content = url;
} }
} }
CustomToast.dismiss();
// 组织图片 // 组织图片
List<Map> images = []; List<Map> images = [];
......
...@@ -28,69 +28,69 @@ class _UserEditNotePageState extends State<UserEditNotePage> { ...@@ -28,69 +28,69 @@ class _UserEditNotePageState extends State<UserEditNotePage> {
margin: EdgeInsets.symmetric(horizontal: 10.w), margin: EdgeInsets.symmetric(horizontal: 10.w),
child: Stack( child: Stack(
children: [ children: [
Container( SingleChildScrollView(
// color: Colours.cF8, padding:EdgeInsets.only(bottom: 100.w),
constraints: BoxConstraints( child: Container(
minHeight: 100.w // color: Colours.cF8,
), constraints: BoxConstraints(
child: Column( minHeight: 100.w
children: [ ),
TextField( child: Column(
// focusNode: widget.controller.discussContentFocusNode, children: [
maxLines: null, TextField(
autofocus: true, // focusNode: widget.controller.discussContentFocusNode,
controller: controller.contentInput, maxLines: null,
decoration: InputDecoration( autofocus: true,
border: InputBorder.none, controller: controller.contentInput,
enabledBorder: InputBorder.none, decoration: InputDecoration(
focusedBorder: InputBorder.none, border: InputBorder.none,
hintText: '请输入内容', enabledBorder: InputBorder.none,
hintStyle:TextStyle(fontSize: 12.w,height: 1.5,color: Colours.c9,), focusedBorder: InputBorder.none,
filled: true, hintText: '请输入内容',
// fillColor: Colours.cF8, hintStyle:TextStyle(fontSize: 12.w,height: 1.5,color: Colours.c9,),
filled: true,
// fillColor: Colours.cF8,
),
), ),
), Column(
Column( children: [
children: [ GridView.builder(
GridView.builder( // padding: const EdgeInsets.only(left: 13,top: 10),
// padding: const EdgeInsets.only(left: 13,top: 10), physics: const NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(), shrinkWrap: true,
shrinkWrap: true, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3,
crossAxisCount: 3, crossAxisSpacing: 2.w,
crossAxisSpacing: 2.w, mainAxisSpacing: 2.w,
mainAxisSpacing: 2.w, childAspectRatio: 1
childAspectRatio: 1 ),
itemBuilder: (BuildContext context, int index) {
MediaModel mediaModel = controller.model.noteContent!.image![index];
return Stack(
children: [
Positioned(
left:0,
right: 0,
top:0,
bottom: 0,
child: mediaModel.id == 0?CustomImage.file(url:mediaModel.path): CustomImage.network(url: mediaModel.content??'')
),
Positioned(
right: 0.w,
top: 0.w,
child: GestureDetector(
onTap: (){
controller.delImage(mediaModel);
},
child: Image.asset('assets/images/media_del.png',width: 17.w,height: 17.w,)
)
)
],
);
},
itemCount: controller.model.noteContent?.image?.length,
), ),
itemBuilder: (BuildContext context, int index) { MediaQuery.removePadding(
MediaModel mediaModel = controller.model.noteContent!.image![index];
return Stack(
children: [
Positioned(
left:0,
right: 0,
top:0,
bottom: 0,
child: mediaModel.id == 0?CustomImage.file(url:mediaModel.path): CustomImage.network(url: mediaModel.content??'')
),
Positioned(
right: 0.w,
top: 0.w,
child: GestureDetector(
onTap: (){
controller.delImage(mediaModel);
},
child: Image.asset('assets/images/media_del.png',width: 17.w,height: 17.w,)
)
)
],
);
},
itemCount: controller.model.noteContent?.image?.length,
),
Container(
// color: Colors.red,
child: MediaQuery.removePadding(
context: context, context: context,
removeTop: true, removeTop: true,
child: ListView.builder( child: ListView.builder(
...@@ -141,20 +141,21 @@ class _UserEditNotePageState extends State<UserEditNotePage> { ...@@ -141,20 +141,21 @@ class _UserEditNotePageState extends State<UserEditNotePage> {
}, },
itemCount: controller.model.noteContent?.audio?.length, itemCount: controller.model.noteContent?.audio?.length,
), ),
), )
) ],
], )
) ],
], ),
), ),
), ),
Visibility( Visibility(
visible: true, visible: true,
child: Positioned( child: Positioned(
left: 10, left: 0,
right: 10, right: 0,
bottom: 0, bottom: 0,
child: Container( child: Container(
color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 10.w), padding: EdgeInsets.symmetric(vertical: 10.w),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
...@@ -169,7 +170,12 @@ class _UserEditNotePageState extends State<UserEditNotePage> { ...@@ -169,7 +170,12 @@ class _UserEditNotePageState extends State<UserEditNotePage> {
); );
controller.addImage(assets!.path); controller.addImage(assets!.path);
}, },
child: Image.asset('assets/images/read_add_img.png')), child: SizedBox(
// color: Colors.red,
width: 25,
height: 25,
child: Image.asset('assets/images/read_add_img.png',fit: BoxFit.contain,)),
),
Gaps.hGaps10, Gaps.hGaps10,
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
...@@ -181,7 +187,11 @@ class _UserEditNotePageState extends State<UserEditNotePage> { ...@@ -181,7 +187,11 @@ class _UserEditNotePageState extends State<UserEditNotePage> {
} }
}, },
child: Image.asset(controller.startRecording?'assets/images/stop.png':'assets/images/read_add_audio.png') child: SizedBox(
width: 23,
height: 23,
child: Image.asset(controller.startRecording?'assets/images/stop.png':'assets/images/read_add_audio.png',fit: BoxFit.contain,)
)
), ),
GestureDetector( GestureDetector(
onTap: (){ onTap: (){
...@@ -191,7 +201,11 @@ class _UserEditNotePageState extends State<UserEditNotePage> { ...@@ -191,7 +201,11 @@ class _UserEditNotePageState extends State<UserEditNotePage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Gaps.hGaps10, Gaps.hGaps10,
Image.asset(controller.isPublic?'assets/images/pay_check.png':'assets/images/pay_uncheck.png'), SizedBox(
width: 15,
height: 15,
child: Image.asset(controller.isPublic?'assets/images/pay_check.png':'assets/images/public.png',fit: BoxFit.contain,)
),
SizedBox(width: 3.w,), SizedBox(width: 3.w,),
Text('公开',style: TextStyle(fontSize: 13.w,height: 1.3,color: Colours.c9),) Text('公开',style: TextStyle(fontSize: 13.w,height: 1.3,color: Colours.c9),)
], ],
......
...@@ -40,6 +40,7 @@ class _UserNickPageState extends State<UserNickPage> { ...@@ -40,6 +40,7 @@ class _UserNickPageState extends State<UserNickPage> {
// print("保存昵称"); // print("保存昵称");
controller.changeInfo(_textFieldController.text); controller.changeInfo(_textFieldController.text);
_focusNode.unfocus(); _focusNode.unfocus();
Tools.unfocus();
}, },
child: Text( child: Text(
'保存', '保存',
......
...@@ -86,7 +86,7 @@ class UserNotesDesController extends GetxController { ...@@ -86,7 +86,7 @@ class UserNotesDesController extends GetxController {
if(noteModel.noteContent!=null && noteModel.noteContent!.audio != null){ if(noteModel.noteContent!=null && noteModel.noteContent!.audio != null){
if(noteModel.noteContent!.audio!.isNotEmpty){ if(noteModel.noteContent!.audio!.isNotEmpty){
for(MediaModel? mediaModel in noteModel.noteContent!.audio!){ for(MediaModel? mediaModel in noteModel.noteContent!.audio!){
Duration? duration = await just_audio.AudioPlayer().setUrl(mediaModel?.content??''); Duration? duration = await audioPlayer.setUrl(mediaModel?.content??'');
mediaModel?.duration = Tools.formatDuration(duration!); mediaModel?.duration = Tools.formatDuration(duration!);
} }
......
...@@ -66,18 +66,20 @@ class BuildNote extends StatelessWidget { ...@@ -66,18 +66,20 @@ class BuildNote extends StatelessWidget {
_showText(model).isEmpty?const SizedBox():Row( _showText(model).isEmpty?const SizedBox():Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text(_showText(model),style: TextStyle( Expanded(
fontSize: 14.w, child: Text(_showText(model),style: TextStyle(
height: 1.5, fontSize: 14.w,
// color: Colors.red, height: 1.5,
color:Colours.c3 // color: Colors.red,
),), color:Colours.c3
),maxLines: 999,overflow: TextOverflow.ellipsis,),
),
Text(_showStatus(model),style: TextStyle(fontSize: 11.w,height: 1.5,color: AppTheme.primary),), Text(_showStatus(model),style: TextStyle(fontSize: 11.w,height: 1.5,color: AppTheme.primary),),
], ],
), ),
Gaps.vGaps13, model.noteContent!.image!.isEmpty?const SizedBox():Gaps.vGaps13,
_buildImageGridView(), _buildImageGridView(),
Gaps.vGaps13, model.noteContent!.audio!.isEmpty?const SizedBox():Gaps.vGaps13,
_buildAudioListView(), _buildAudioListView(),
Gaps.vGaps13, Gaps.vGaps13,
Container( Container(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论