w-R
3 years ago
5 changed files with 173 additions and 10 deletions
@ -0,0 +1,12 @@
|
||||
import 'package:flutter/material.dart'; |
||||
|
||||
class RenameDialog extends AlertDialog { |
||||
RenameDialog({Widget contentWidget}) |
||||
: super( |
||||
content: contentWidget, |
||||
contentPadding: EdgeInsets.zero, |
||||
shape: RoundedRectangleBorder( |
||||
borderRadius: BorderRadius.circular(20), |
||||
side: BorderSide(color: Colors.white, width: 3)), |
||||
); |
||||
} |
@ -0,0 +1,104 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
|
||||
double btnHeight = 60; |
||||
double borderWidth = 2; |
||||
|
||||
class RenameDialogContent extends StatefulWidget { |
||||
final String title; |
||||
final VoidCallback cancelBtnTap; |
||||
final VoidCallback okBtnTap; |
||||
final TextEditingController vc; |
||||
RenameDialogContent( |
||||
{@required this.title, |
||||
this.cancelBtnTap, |
||||
this.okBtnTap, |
||||
this.vc}); |
||||
|
||||
@override |
||||
_RenameDialogContentState createState() => |
||||
_RenameDialogContentState(); |
||||
} |
||||
|
||||
class _RenameDialogContentState extends State<RenameDialogContent> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
margin: EdgeInsets.only(top: 20), |
||||
height: 200, |
||||
width: 10000, |
||||
alignment: Alignment.bottomCenter, |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
alignment: Alignment.center, |
||||
child: Text( |
||||
widget.title, |
||||
style: TextStyle(color: Colors.grey), |
||||
)), |
||||
Spacer(), |
||||
Padding( |
||||
padding: EdgeInsets.fromLTRB(30, 0, 30, 0), |
||||
child: TextField( |
||||
style: TextStyle(color: Colors.black87), |
||||
controller: widget.vc, |
||||
decoration: InputDecoration( |
||||
enabledBorder: UnderlineInputBorder( |
||||
borderSide: BorderSide(color: Colors.black), |
||||
), |
||||
focusedBorder: UnderlineInputBorder( |
||||
borderSide: BorderSide(color: Colors.black), |
||||
)), |
||||
), |
||||
), |
||||
Container( |
||||
// color: Colors.red, |
||||
height: btnHeight, |
||||
margin: EdgeInsets.fromLTRB(0, 30, 0, 0), |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
// 按钮上面的横线 |
||||
width: double.infinity, |
||||
color: Colors.white, |
||||
height: borderWidth, |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
children: [ |
||||
FlatButton( |
||||
onPressed: () { |
||||
widget.vc.text = ""; |
||||
widget.cancelBtnTap(); |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Text( |
||||
S.of(context).quxiao, |
||||
style: TextStyle(fontSize: 18, color: Colors.black), |
||||
), |
||||
), |
||||
Container( |
||||
// 按钮中间的竖线 |
||||
width: borderWidth, |
||||
color: Colors.grey, |
||||
height: btnHeight - borderWidth - borderWidth, |
||||
), |
||||
FlatButton( |
||||
onPressed: () { |
||||
widget.okBtnTap(); |
||||
Navigator.of(context).pop(); |
||||
widget.vc.text = ""; |
||||
}, |
||||
child: Text( |
||||
S.of(context).queding, |
||||
style: TextStyle(fontSize:18, color: Colors.black), |
||||
)), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
) |
||||
], |
||||
)); |
||||
} |
||||
} |
Loading…
Reference in new issue