|
|
import 'package:flutter/material.dart';
|
|
|
import 'customDialogC.dart';
|
|
|
import 'commonFun.dart';
|
|
|
|
|
|
//视频列表對話框
|
|
|
class customDialogA extends Dialog {
|
|
|
String title;
|
|
|
String content;
|
|
|
String url;
|
|
|
|
|
|
customDialogA({this.title = "", this.content = "", this.url = ''});
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
Size mediaSize = MediaQuery.of(context).size;
|
|
|
// TODO: implement build
|
|
|
return WillPopScope(
|
|
|
child: Material(
|
|
|
type: MaterialType.transparency,
|
|
|
child: Container(
|
|
|
alignment: Alignment(0, 0),
|
|
|
child: Container(
|
|
|
// height: 260,
|
|
|
// width: 300,
|
|
|
height: mediaSize.height * 0.85,
|
|
|
width: mediaSize.width * 0.95,
|
|
|
//color: Colors.white, //Cannot provide both a color and a decoration
|
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.white,
|
|
|
//border: Border.all(color: Colors.blue, width: 1.0),
|
|
|
borderRadius: BorderRadius.all(
|
|
|
Radius.circular(2),
|
|
|
),
|
|
|
),
|
|
|
child: Column(
|
|
|
children: <Widget>[
|
|
|
Padding(
|
|
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
|
|
|
child: Stack(
|
|
|
children: <Widget>[
|
|
|
Align(
|
|
|
alignment: Alignment.center,
|
|
|
child: Text("${this.title}",
|
|
|
style: TextStyle(
|
|
|
fontSize: 18.0,
|
|
|
)),
|
|
|
),
|
|
|
Align(
|
|
|
alignment: Alignment.centerRight,
|
|
|
child: InkWell(
|
|
|
child: Icon(Icons.close),
|
|
|
onTap: () {
|
|
|
Navigator.pop(context, url);
|
|
|
},
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
Divider(),
|
|
|
//addDialoadContainer4(context, g_list, url),
|
|
|
//MyDialogContent(countries: ['china', 'England']),
|
|
|
MyDialogContent(list: g_list, url: url),
|
|
|
SizedBox(height: 10),
|
|
|
Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
children: <Widget>[
|
|
|
RaisedButton(
|
|
|
onPressed: () {
|
|
|
Navigator.pop(context, url);
|
|
|
},
|
|
|
child: Text("取消"),
|
|
|
),
|
|
|
RaisedButton(
|
|
|
child: Text("确认"),
|
|
|
onPressed: () async {
|
|
|
Navigator.pop(context, url); //关闭弹框,播放输入视频地址
|
|
|
},
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
onWillPop: () {
|
|
|
// 屏蔽点击返回键的操作
|
|
|
//player.pause();
|
|
|
Navigator.pop(context, url);
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
class MyDialogContent extends StatefulWidget {
|
|
|
List<String> list;
|
|
|
String url;
|
|
|
MyDialogContent({this.list, this.url});
|
|
|
|
|
|
@override
|
|
|
_MyDialogContentState createState() => new _MyDialogContentState();
|
|
|
}
|
|
|
|
|
|
class _MyDialogContentState extends State<MyDialogContent> {
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return addDialoadContainer4(context, widget.list, widget.url);
|
|
|
}
|
|
|
|
|
|
Widget addDialoadContainer4(
|
|
|
BuildContext context, List<String> list, String url) {
|
|
|
Size mediaSize = MediaQuery.of(context).size;
|
|
|
|
|
|
int i = 0;
|
|
|
print('\ng_list start =========================================\n');
|
|
|
for (var s in list) {
|
|
|
print('$i - ' + s + '\n');
|
|
|
i++;
|
|
|
}
|
|
|
print('g_list start =========================================\n\n');
|
|
|
|
|
|
return Container(
|
|
|
height: mediaSize.height * 0.65, //0.75越界,0.7不越界。需要0.2 = 0.9 - 0.7
|
|
|
width: mediaSize.width * 0.9,
|
|
|
child: ListView.builder(
|
|
|
shrinkWrap: true,
|
|
|
itemCount: list.length,
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
int index2 = index + 1;
|
|
|
return Column(
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: <Widget>[
|
|
|
Container(
|
|
|
padding: EdgeInsets.fromLTRB(20, 0, 10, 0),
|
|
|
child: InkWell(
|
|
|
child: Text('$index2 : ' + list[index],
|
|
|
style: TextStyle(fontSize: 15.0)),
|
|
|
onTap: () {
|
|
|
print('index : $index');
|
|
|
Navigator.pop(context, list[index]);
|
|
|
},
|
|
|
onLongPress: () async {
|
|
|
await showDialog(
|
|
|
context: context,
|
|
|
builder: (context) {
|
|
|
myController.text = '';
|
|
|
return CustomDialogC(
|
|
|
title: "选择操作",
|
|
|
url: g_list[index],
|
|
|
index: index,
|
|
|
);
|
|
|
});
|
|
|
setState(() {});
|
|
|
},
|
|
|
),
|
|
|
),
|
|
|
Divider(),
|
|
|
],
|
|
|
);
|
|
|
},
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
}
|