import 'package:flutter/material.dart'; import 'commonFun.dart'; //删除确认对话框 class CustomDialogC extends Dialog { String title; String url; int index; CustomDialogC({this.title = "", this.url = "", this.index}); @override Widget build(BuildContext context) { Size mediaSize = MediaQuery.of(context).size; return WillPopScope( child: Material( type: MaterialType.transparency, child: Container( alignment: Alignment(0, -0.7), child: Container( // height: 260, // width: 300, height: mediaSize.height * 0.35, width: mediaSize.width * 0.85, //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: [ Padding( padding: EdgeInsets.fromLTRB(10, 10, 10, 0), child: Stack( children: [ Align( alignment: Alignment.center, child: Text( "${this.title}", style: TextStyle( fontSize: 15.0, ), ), ), Align( alignment: Alignment.centerRight, child: InkWell( child: Icon(Icons.close), onTap: () { Navigator.pop(context, url); }, ), ) ], ), ), Divider(), Container( padding: EdgeInsets.fromLTRB(20, 10, 20, 10), width: double.infinity, height: mediaSize.height * 0.15, child: SingleChildScrollView( child: Text(index.toString() + ' : ' + url), ), ), SizedBox(height: 10), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ // RaisedButton( // onPressed: () async { // await showDialog( // context: context, // builder: (context) { // myController.text = g_list[index].trim(); // return CustomDialogD( // title: "修改视频地址", // content: g_list[index].trim(), // url: urlnew); // }); // String url0 = g_list[index].trim().toLowerCase(); // String url2 = myController.text.trim().toLowerCase(); // if (url2.isNotEmpty && 0 != url0.compareTo(url2)) { // g_list.removeAt(index); // g_list.add(url2); // await updateFile(); // } // Navigator.pop(context, url); //关闭弹框,返回sRet // }, // child: Text("修改"), // ), RaisedButton( onPressed: () async { g_list.removeAt(index); //await updateFile(); //writeUrlFile2(); Navigator.pop(context, url); //关闭弹框,返回sRet }, child: Text("删除"), ), RaisedButton( child: Text("取消"), onPressed: () async { Navigator.pop(context, url); //关闭弹框,返回sRet }, ) ], ), ], ), ), ), ), onWillPop: () { // 屏蔽点击返回键的操作 //player.pause(); Navigator.pop(context, url); }, ); } }