interrogation_page.dart 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. import 'package:flutter/material.dart';
  2. import 'package:liftmanager/res/gaps.dart';
  3. import 'package:liftmanager/net/api_service.dart';
  4. import 'package:liftmanager/utils/toast.dart';
  5. import 'package:liftmanager/widgets/app_bar.dart';
  6. import 'package:liftmanager/internal/search/search_router.dart';
  7. import 'package:liftmanager/widgets/app_search_bar.dart';
  8. import 'package:liftmanager/res/resources.dart';
  9. import 'package:liftmanager/routers/fluro_navigator.dart';
  10. import 'package:liftmanager/widgets/load_image.dart';
  11. import 'package:liftmanager/widgets/selected_image_change.dart';
  12. import 'package:image_picker/image_picker.dart';
  13. import 'dart:io';
  14. import 'package:flutter_screenutil/flutter_screenutil.dart';
  15. import 'package:liftmanager/internal/bbs/bbs_router.dart';
  16. import 'dart:convert';
  17. import 'package:shared_preferences/shared_preferences.dart';
  18. import 'package:liftmanager/common/common.dart';
  19. import 'package:flustars/flustars.dart' as flustars;
  20. import 'package:liftmanager/utils/theme_utils.dart';
  21. import 'package:chewie/chewie.dart';
  22. import 'package:liftmanager/utils/oss_upload.dart';
  23. import 'package:video_player/video_player.dart';
  24. import 'package:liftmanager/widgets/selected_video_change.dart';
  25. import 'package:liftmanager/utils/utils.dart';
  26. import 'package:orientation/orientation.dart';
  27. import 'package:flutter/services.dart';
  28. import 'package:liftmanager/utils/fast_notification.dart';
  29. class InterrogationPage extends StatefulWidget {
  30. InterrogationPage(this.brandName,this.brandId);
  31. final String brandName;
  32. final String brandId;
  33. @override
  34. State<StatefulWidget> createState() {
  35. return InterrogationPageState();
  36. }
  37. }
  38. class InterrogationPageState extends State<InterrogationPage> {
  39. // NewsDetailItem item = NewsDetailItem();
  40. List<String> imagesUrl = [];
  41. String videoUrl;
  42. String str;
  43. double percent = 0.0;
  44. String addressName = "";
  45. VideoPlayerController _controller;
  46. VideoPlayerController _controllerFile;
  47. @override
  48. void initState() {
  49. super.initState();
  50. print(widget.brandName);
  51. print(widget.brandId);
  52. print(65656);
  53. }
  54. //图片
  55. upLoadFileOnce(path) {
  56. showLoading(context, "正在上传...");
  57. NewApiService().upload(path, onSuccess: (res) {
  58. // imagesUrl.add(res.path);
  59. dismissLoading(context);
  60. setState(() {
  61. imagesUrl.add(res.pathUrl);
  62. });
  63. }, onError: (code, msg) {
  64. dismissLoading(context);
  65. toasts(msg);
  66. });
  67. }
  68. //视频
  69. upLoadFileOnceVideo(path) {
  70. showLoading(context, "正在上传...");
  71. NewApiService().upload(path, onSuccess: (res) {
  72. // imagesUrl.add(res.path);
  73. dismissLoading(context);
  74. setState(() {
  75. // videoUrl.add(res.pathUrl);
  76. // imagesUrlVideo.add(res.coverUrl);
  77. });
  78. }, onError: (code, msg) {
  79. dismissLoading(context);
  80. toasts(msg);
  81. });
  82. }
  83. ///选择图片
  84. void selectPicker(type) {
  85. showDialog(
  86. context: context,
  87. builder: (BuildContext context) {
  88. return SimpleDialog(
  89. title: Text("选择方式"),
  90. children: ["拍照", '从手机相册选择'].map((String value) {
  91. print("$value");
  92. return SimpleDialogOption(
  93. child: Text(
  94. "${value}",
  95. style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
  96. ),
  97. onPressed: () {
  98. if(type=="image"){
  99. _getImage(value == '拍照' ? 1 : 0);
  100. }else if (type=="video") {
  101. _getVideo(value == '拍照' ? 1 : 0);
  102. }
  103. Navigator.of(context).pop();
  104. },
  105. );
  106. }).toList());
  107. });
  108. }
  109. void _getImage(int key) async {
  110. try {
  111. var _imageFile = await ImagePicker.pickImage(
  112. source: key == 1 ? ImageSource.camera : ImageSource.gallery,
  113. maxWidth: 800,
  114. imageQuality: 95);
  115. print(_imageFile);
  116. print(3333);
  117. if (_imageFile != null) {
  118. // images.add(_imageFile);
  119. upLoadFileOnce(_imageFile.path);
  120. // setState(() {});
  121. }
  122. } catch (e) {
  123. toasts("没有权限,无法打开相册!");
  124. }
  125. }
  126. void _getVideo(int key) async {
  127. print(key);
  128. print(333);
  129. try {
  130. await ImagePicker.pickVideo(
  131. source: key == 1 ? ImageSource.camera : ImageSource.gallery,
  132. )
  133. .then((File f) async{
  134. if (f != null) {
  135. _controllerFile = VideoPlayerController.file(f);
  136. _controllerFile.initialize().then((val){
  137. _controllerFile.setLooping(true);
  138. int seconds = _controllerFile.value.duration.inSeconds;
  139. print("视频时长:$seconds");
  140. int fileSize=f.lengthSync();//单位B
  141. print("视频大小:${fileSize}");
  142. print("视频大小:${f.path}");
  143. if (seconds <= 300) {
  144. _uploadImage(f.path);
  145. // upLoadFileOnce(_imageFile.path);
  146. // setState(() {});
  147. }else {
  148. toasts("视频时长不能大于5分钟!");
  149. }
  150. });}
  151. })
  152. ;
  153. } catch (e) {
  154. toasts("没有权限,无法打开相册!");
  155. }
  156. }
  157. void _uploadImage(filePath) async {
  158. showPercent(context, (){
  159. dismissLoading(context);
  160. toasts("上传失败");
  161. },(){
  162. if(videoUrl == null && str != null){
  163. setState(() {
  164. videoUrl = str;
  165. print("videoUrl:"+videoUrl);
  166. dismissLoading(context);
  167. toasts("上传成功");
  168. });
  169. }
  170. });
  171. String uploadName = OssUtil.instance.getImageUploadName(filePath);
  172. await NewApiService.uploadImage(context, uploadName, filePath).then((data) {
  173. if (data.statusCode == 200) {
  174. str = NewApiUrl.URL_UPLOAD_IMAGE_OSS + "/" + uploadName;
  175. print("str:"+str);
  176. print(videoUrl);
  177. if(str != null){
  178. Map obj = {
  179. "uploadName":uploadName,
  180. "success":true
  181. };
  182. FastNotification.push("percent",obj);
  183. }
  184. }else {
  185. Map obj = {
  186. "uploadName":uploadName,
  187. "success":false
  188. };
  189. FastNotification.push("percent",obj);
  190. }
  191. }).catchError((data) {
  192. Map obj = {
  193. "uploadName":uploadName,
  194. "success":false
  195. };
  196. FastNotification.push("percent",obj);
  197. });
  198. }
  199. // 焦点控制
  200. // FocusNode _focusNode1 = new FocusNode();
  201. GlobalKey _formKey= new GlobalKey<FormState>();
  202. TextEditingController _questionController = new TextEditingController();
  203. TextEditingController _methodController = new TextEditingController();
  204. FocusNode blankNode = FocusNode();
  205. @override
  206. Widget build(BuildContext context) {
  207. double width = MediaQuery.of(context).size.width;
  208. // 监听FocusNode
  209. // _focusNode1.addListener((){
  210. // // _focusNode1.hasFocus 是否聚焦
  211. // print(_focusNode1.hasFocus);
  212. // });
  213. return Scaffold(
  214. resizeToAvoidBottomPadding: false,//不让键盘弹上去
  215. appBar: MyAppBar(
  216. centerTitle: "我要提问",
  217. ),
  218. body: GestureDetector(
  219. onTap: (){
  220. // 点击空白页面关闭键盘
  221. FocusScope.of(context).requestFocus(blankNode);
  222. },
  223. child: Stack(
  224. children:<Widget>[
  225. Container(
  226. padding: EdgeInsets.only(bottom:ScreenUtil().setWidth(80)),
  227. child: ListView(
  228. children: <Widget>[
  229. Form(
  230. key: _formKey, //设置globalKey,用于后面获取FormState
  231. // autovalidate: true, //开启自动校验
  232. child: Column(
  233. children: <Widget>[
  234. Container(
  235. padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  236. decoration: BoxDecoration(
  237. border: Border(
  238. bottom: BorderSide(width: 0.5, color: Colours.line),
  239. ),
  240. ),
  241. child: Row(
  242. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  243. children:<Widget>[
  244. Text(
  245. "电梯品牌",
  246. style: TextStyle(
  247. // fontSize:ScreenUtil().setSp(14)
  248. ),
  249. textAlign:TextAlign.start,
  250. ),
  251. Text(
  252. widget.brandName,
  253. style: TextStyle(
  254. color:Color(0xff999999),
  255. // fontSize:ScreenUtil().setSp(14)
  256. ),
  257. textAlign:TextAlign.start,
  258. ),
  259. ]
  260. ),
  261. ),
  262. Row(
  263. crossAxisAlignment: CrossAxisAlignment.start,
  264. mainAxisAlignment: MainAxisAlignment.start,
  265. children: <Widget>[
  266. Container(
  267. padding:EdgeInsets.only(left:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(5)),
  268. child: Text(
  269. "问题描述",
  270. style: TextStyle(
  271. // fontSize:ScreenUtil().setSp(14),
  272. ),
  273. textAlign:TextAlign.left,
  274. ),
  275. ),
  276. ],
  277. ),
  278. Container(
  279. height:120,
  280. padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(15),bottom:ScreenUtil().setWidth(20)),
  281. child: TextFormField(
  282. // autofocus: true,
  283. maxLength: 50,
  284. cursorColor: Color(0xffcccccc),
  285. controller: _questionController,
  286. maxLines:5,
  287. decoration: InputDecoration(
  288. contentPadding: EdgeInsets.all(0),
  289. hintText: '请详细描述事故问题和现场情况',
  290. hintStyle:TextStyle(
  291. color: Color(0xffcccccc),
  292. // fontSize: ScreenUtil().setSp(14),
  293. ),
  294. focusedBorder: InputBorder.none,
  295. border: InputBorder.none,
  296. // filled: true, // 背景色
  297. // fillColor: Colors.cyan.withAlpha(35),
  298. // icon: Icon(Icons.person)
  299. ),
  300. // 校验
  301. validator: (val) {
  302. return val.trim().length > 0 ? null : "不能为空";
  303. }
  304. ),
  305. ),
  306. SizedBox(
  307. height:6,
  308. child: Container(
  309. color:ThemeUtils.getDialogTextFieldColor(context)
  310. ),
  311. ),
  312. Row(
  313. crossAxisAlignment: CrossAxisAlignment.start,
  314. mainAxisAlignment: MainAxisAlignment.start,
  315. children: <Widget>[
  316. Container(
  317. padding:EdgeInsets.only(left:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(5)),
  318. child: Text(
  319. "已尝试方法",
  320. style: TextStyle(
  321. // fontSize:ScreenUtil().setSp(14),
  322. ),
  323. textAlign:TextAlign.left,
  324. ),
  325. ),
  326. ],
  327. ),
  328. Container(
  329. height:120,
  330. padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(15),bottom:ScreenUtil().setWidth(20)),
  331. child: TextFormField(
  332. // autofocus: true,
  333. maxLength: 50,
  334. cursorColor: Color(0xffcccccc),
  335. controller: _methodController,
  336. maxLines:5,
  337. decoration: InputDecoration(
  338. contentPadding: EdgeInsets.all(0),
  339. hintText: '请详细描述已尝试方法以及结果',
  340. hintStyle:TextStyle(
  341. color: Color(0xffcccccc),
  342. // fontSize: ScreenUtil().setSp(14),
  343. ),
  344. focusedBorder: InputBorder.none,
  345. border: InputBorder.none,
  346. // filled: true, // 背景色
  347. // fillColor: Colors.cyan.withAlpha(35),
  348. // icon: Icon(Icons.person)
  349. ),
  350. // 校验
  351. validator: (val) {
  352. return val.trim().length > 0 ? null : "不能为空";
  353. }
  354. ),
  355. ),
  356. SizedBox(
  357. height:6,
  358. child: Container(
  359. color:ThemeUtils.getDialogTextFieldColor(context)
  360. ),
  361. ),
  362. Container(
  363. width: width,
  364. padding: EdgeInsets.only(left:15,top:15),
  365. child: Text(
  366. "上传图片:",
  367. style: TextStyle(
  368. fontSize:
  369. ScreenUtil()
  370. .setSp(14),
  371. ),
  372. textAlign: TextAlign.left,
  373. ),
  374. ),
  375. Container(
  376. color: ThemeUtils.getTabsBg(context),
  377. child: GridView.builder(
  378. shrinkWrap: true,
  379. padding: const EdgeInsets.fromLTRB(8.0, 12, 8.0, 12.0),
  380. physics: NeverScrollableScrollPhysics(),
  381. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  382. crossAxisCount: 3, childAspectRatio: 1.18),
  383. itemCount: imagesUrl.length >= 9 ? 9 : imagesUrl.length + 1,
  384. itemBuilder: (_, index) {
  385. return Stack(
  386. children: <Widget>[
  387. Center(
  388. child: SelectedImage(
  389. image: index < imagesUrl.length ? imagesUrl[index] : null,
  390. index:index,
  391. onTap: () {
  392. if(index >= imagesUrl.length){
  393. selectPicker("image");
  394. }
  395. FocusScope.of(context).requestFocus(FocusNode());
  396. print(index);
  397. print(imagesUrl);
  398. }),
  399. ),
  400. index < imagesUrl.length?Positioned(
  401. top:0,
  402. right:0,
  403. child:GestureDetector(
  404. onTap: (){
  405. print(index);
  406. imagesUrl.remove(imagesUrl[index]);
  407. setState(() {
  408. });
  409. },
  410. child:Icon(
  411. IconData(
  412. 0xe62a,
  413. fontFamily:"myfont"
  414. ),
  415. size: 24.0,
  416. color:Color(0xff999999),
  417. ),
  418. )
  419. ):Container(child: null,)
  420. ],
  421. );
  422. },
  423. )
  424. ),
  425. SizedBox(
  426. height:6,
  427. child: Container(
  428. color:ThemeUtils.getDialogTextFieldColor(context)
  429. ),
  430. ),
  431. Container(
  432. width: width,
  433. padding: EdgeInsets.only(left:15,top:15),
  434. child: Text(
  435. "上传视频:",
  436. style: TextStyle(
  437. fontSize:
  438. ScreenUtil()
  439. .setSp(14),
  440. ),
  441. textAlign: TextAlign.left,
  442. ),
  443. ),
  444. Container(
  445. width: width,
  446. padding: EdgeInsets.only(left:15,bottom:15),
  447. child: Text(
  448. "(建议时长3分钟,建议大小50M)",
  449. style: TextStyle(
  450. color: Colors.red,
  451. fontSize:
  452. ScreenUtil()
  453. .setSp(14),
  454. ),
  455. textAlign: TextAlign.left,
  456. ),
  457. ),
  458. // Container(
  459. // color: ThemeUtils.getTabsBg(context),
  460. // child: GridView.builder(
  461. // shrinkWrap: true,
  462. // padding: const EdgeInsets.fromLTRB(8.0, 12, 8.0, 12.0),
  463. // physics: NeverScrollableScrollPhysics(),
  464. // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  465. // crossAxisCount: 3, childAspectRatio: 1.18),
  466. // itemCount: videoUrl.length >= 1 ? 1 : videoUrl.length + 1,
  467. // itemBuilder: (_, index) {
  468. // return Stack(
  469. // children: <Widget>[
  470. // Center(
  471. // child: SelectedImage(
  472. // image: index < videoUrl.length ? imagesUrlVideo[index] : null,
  473. // index:index,
  474. // onTap: () {
  475. // if(index >= videoUrl.length){
  476. // selectPicker("video");
  477. // }
  478. // FocusScope.of(context).requestFocus(FocusNode());
  479. // print(index);
  480. // print(videoUrl);
  481. // }),
  482. // ),
  483. // index < videoUrl.length?Positioned(
  484. // top:0,
  485. // right:0,
  486. // child:GestureDetector(
  487. // onTap: (){
  488. // print(index);
  489. // videoUrl.remove(videoUrl[index]);
  490. // imagesUrlVideo.remove(imagesUrlVideo[index]);
  491. // setState(() {
  492. // });
  493. // },
  494. // child:Icon(
  495. // IconData(
  496. // 0xe62a,
  497. // fontFamily:"myfont"
  498. // ),
  499. // size: 24.0,
  500. // color:Color(0xff999999),
  501. // ),
  502. // )
  503. // ):Container(child: null,)
  504. // ],
  505. // );
  506. // },
  507. // )
  508. // ),
  509. Container(
  510. color: ThemeUtils.getDialogTextFieldColor(context),
  511. child: GridView.builder(
  512. shrinkWrap: true,
  513. padding: const EdgeInsets.fromLTRB(8.0, 12, 8.0, 12.0),
  514. physics: NeverScrollableScrollPhysics(),
  515. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  516. crossAxisCount: 1, childAspectRatio: 1.18),
  517. itemCount: 1,
  518. itemBuilder: (_, index) {
  519. return Stack(
  520. children: <Widget>[
  521. Center(
  522. child: SelectedVideo(
  523. image: videoUrl,
  524. index: index,
  525. videoPlay:videoPlay(),
  526. onTap: () {
  527. if(videoUrl == null){
  528. selectPicker("video");
  529. }
  530. },
  531. ),
  532. ),
  533. videoUrl != null
  534. ? Positioned(
  535. top: 0,
  536. right: 0,
  537. child: GestureDetector(
  538. onTap: () {
  539. print(index);
  540. // imagesUrl = null;
  541. setState(() {
  542. videoUrl = null;
  543. str = null;
  544. _controller.pause();
  545. // player.reset();
  546. });
  547. },
  548. child: Icon(
  549. IconData(0xe62a, fontFamily: "myfont"),
  550. size: 24.0,
  551. color: Color(0xff999999),
  552. ),
  553. ),
  554. )
  555. : Container(
  556. child: null,
  557. )
  558. ],
  559. );
  560. },
  561. ),
  562. ),
  563. ],
  564. ),
  565. )
  566. ]
  567. )
  568. ),
  569. Positioned(
  570. bottom:0,
  571. left:0,
  572. child:Container(
  573. width: width,
  574. padding: EdgeInsets.only(top:ScreenUtil().setWidth(15),bottom:ScreenUtil().setWidth(15),left:ScreenUtil().setWidth(25),right:ScreenUtil().setWidth(25)),
  575. color:ThemeUtils.getDialogTextFieldColor(context),
  576. child: Container(
  577. height:ScreenUtil().setWidth(44),
  578. decoration: BoxDecoration(
  579. borderRadius: BorderRadius.circular(22.0),
  580. gradient: const LinearGradient(
  581. colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
  582. ),
  583. child: FlatButton(
  584. // padding: EdgeInsets.all(15.0),
  585. child: Text("提交"),
  586. textColor: Colors.white,
  587. // textColor: Colors.white,
  588. onPressed: () {
  589. // if(imagesUrl.length<1){
  590. // toasts("请上传图片");
  591. // return;
  592. // }
  593. String imgs = "";
  594. if(imagesUrl.length > 0){
  595. imgs = imagesUrl.join(",");
  596. }
  597. // String videoImgs = "";
  598. // if(videoUrl.length > 0){
  599. // videoImgs = videoUrl.join(",");
  600. // }
  601. if((_formKey.currentState as FormState).validate()){
  602. dynamic obj = {
  603. "dataTable":"1",
  604. "brandId":widget.brandId,
  605. "expression":_questionController.text,
  606. "usedMethods":_methodController.text,
  607. "imgs":imgs,
  608. "videoUrl":videoUrl,
  609. "createUserId":int.parse(flustars.SpUtil.getString(Constant.userId)),
  610. "chargerId":1
  611. };
  612. showLoading(context, "正在提交...");
  613. NewApiService().createCase(obj, onSuccess: (res) {
  614. dismissLoading(context);
  615. toasts("提交成功");
  616. FocusScope.of(context).requestFocus(FocusNode());
  617. print(res);
  618. print(999999);
  619. setDataId(res);
  620. setType("1");
  621. print(widget.brandId);
  622. NavigatorUtils.push(context, "${BbsRouter.expertList}?id=${widget.brandId}");
  623. }, onError: (code, msg) {
  624. dismissLoading(context);
  625. toasts(msg);
  626. });
  627. }
  628. },
  629. ),
  630. ),
  631. )
  632. )
  633. ]
  634. ),
  635. ),
  636. );
  637. }
  638. void setDataId (int id)async{
  639. SharedPreferences prefs = await SharedPreferences.getInstance();
  640. prefs.setInt("dataId", id);
  641. }
  642. void setType (String type)async{
  643. SharedPreferences prefs = await SharedPreferences.getInstance();
  644. prefs.setString("questionType", type);
  645. }
  646. Widget videoPlay() {
  647. _controller = VideoPlayerController.network(
  648. Utils.getImagePath(videoUrl)
  649. // imgFontUrl + detailObj.url
  650. );
  651. double width = MediaQuery.of(context).size.width;
  652. return
  653. // Container(
  654. // width: width,
  655. // height: width*0.6,
  656. // alignment: Alignment.center,
  657. // child: FijkView(
  658. // player: player,
  659. // color: Colors.black,
  660. // fit:FijkFit.fill,
  661. // // cover: NetworkImage(detailObj.cover),
  662. // // cover: new Image(image: detailObj.cover!=null&& detailObj.cover!=""?NetworkImage(detailObj.cover):AssetImage("assets/images/video_image.png"),).image,
  663. // //
  664. // ),
  665. // );
  666. Container(
  667. padding: EdgeInsets.only(
  668. left: ScreenUtil().setWidth(15),
  669. right: ScreenUtil().setWidth(15),
  670. top: ScreenUtil().setWidth(15)),
  671. child: ClipRRect(
  672. borderRadius: BorderRadius.circular(5),
  673. child:
  674. new Chewie(
  675. controller: ChewieController(
  676. videoPlayerController:
  677. // VideoPlayerController.network(
  678. // imgFontUrl + detailObj.url
  679. // ),
  680. _controller,
  681. aspectRatio: 3 / 2,
  682. allowFullScreen:false,
  683. autoPlay: false,
  684. looping: true,
  685. // startAt: Duration(seconds: 1,minutes: 1),
  686. showControls: true,
  687. deviceOrientationsAfterFullScreen:[DeviceOrientation.portraitUp],
  688. // 占位图
  689. // placeholder: Image.network(
  690. // imgFontUrl+detailObj.cover,
  691. // fit: BoxFit.contain,
  692. // ),
  693. // 是否在 UI 构建的时候就加载视频
  694. autoInitialize: true,
  695. // 拖动条样式颜色
  696. materialProgressColors:
  697. new ChewieProgressColors(
  698. playedColor: Colors.red,
  699. handleColor: Colors.blue,
  700. backgroundColor: Colors.grey,
  701. bufferedColor: Colors.lightGreen,
  702. ),
  703. ),
  704. ),
  705. )
  706. );
  707. }
  708. }