Browse Source

fix deprecated flatbutton

pull/24/head
Neo Sun 3 years ago
parent
commit
19fac414f6
  1. 78
      lib/apps/file/editor.dart
  2. 179
      lib/utils/emoji_picker.dart

78
lib/apps/file/editor.dart

@ -185,10 +185,10 @@ class _EditorPageState extends State<EditorPage> {
controller: this._controller!, controller: this._controller!,
showAlignmentButtons: true, showAlignmentButtons: true,
multiRowsDisplay: isDesktop, multiRowsDisplay: isDesktop,
onImagePickCallback: _onImagePickCallback, //onImagePickCallback: _onImagePickCallback,
onVideoPickCallback: _onImagePickCallback, //onVideoPickCallback: _onImagePickCallback,
mediaPickSettingSelector: _selectMediaPickSetting, //mediaPickSettingSelector: _selectMediaPickSetting,
filePickImpl: pickMedia, //filePickImpl: pickMedia,
showLink: false, showLink: false,
) )
), ),
@ -206,31 +206,31 @@ class _EditorPageState extends State<EditorPage> {
); );
} }
Future<MediaPickSetting?> _selectMediaPickSetting(BuildContext context) { // Future<MediaPickSetting?> _selectMediaPickSetting(BuildContext context) {
final lang = AppLocalizations.of(context); // final lang = AppLocalizations.of(context);
return showDialog<MediaPickSetting>( // return showDialog<MediaPickSetting>(
context: context, // context: context,
builder: (ctx) => AlertDialog( // builder: (ctx) => AlertDialog(
contentPadding: const EdgeInsets.all(20.0), // contentPadding: const EdgeInsets.all(20.0),
content: Column( // content: Column(
mainAxisSize: MainAxisSize.min, // mainAxisSize: MainAxisSize.min,
children: [ // children: [
TextButton.icon( // TextButton.icon(
icon: const Icon(Icons.collections), // icon: const Icon(Icons.collections),
label: Text(lang.gallery), // label: Text(lang.gallery),
onPressed: () => Navigator.pop(ctx, MediaPickSetting.Gallery), // onPressed: () => Navigator.pop(ctx, MediaPickSetting.Gallery),
), // ),
const Divider(height: 32.0), // const Divider(height: 32.0),
TextButton.icon( // TextButton.icon(
icon: const Icon(Icons.link), // icon: const Icon(Icons.link),
label: Text(lang.link), // label: Text(lang.link),
onPressed: () => Navigator.pop(ctx, MediaPickSetting.Link), // onPressed: () => Navigator.pop(ctx, MediaPickSetting.Link),
) // )
], // ],
), // ),
), // ),
); // );
} // }
Future<String> _checkName(String path, String name) async { Future<String> _checkName(String path, String name) async {
String tryName = name; String tryName = name;
@ -245,14 +245,14 @@ class _EditorPageState extends State<EditorPage> {
return path + name; return path + name;
} }
Future<String> _onImagePickCallback(File file) async { // Future<String> _onImagePickCallback(File file) async {
final dir = Directory(Global.filePath + widget.path.did + '_assets'); // final dir = Directory(Global.filePath + widget.path.did + '_assets');
final isExists = await dir.exists(); // final isExists = await dir.exists();
if (!isExists) { // if (!isExists) {
await dir.create(recursive: true); // await dir.create(recursive: true);
} // }
final pathname = await _checkName(dir.path + '/', basename(file.path)); // final pathname = await _checkName(dir.path + '/', basename(file.path));
final copiedFile = await file.copy(pathname); // final copiedFile = await file.copy(pathname);
return copiedFile.path.toString(); // return copiedFile.path.toString();
} // }
} }

179
lib/utils/emoji_picker.dart

@ -722,22 +722,21 @@ class _EmojiPickerState extends State<EmojiPicker> {
SizedBox( SizedBox(
width: categoryWidth, width: categoryWidth,
height: categoryWidth, height: categoryWidth,
child: FlatButton( child: TextButton(
padding: EdgeInsets.all(0), style: TextButton.styleFrom(padding: EdgeInsets.all(0),
color: widget.selectedCategory == Category.SMILEYS backgroundColor: widget.selectedCategory == Category.SMILEYS
? Colors.black12 ? Colors.black12
: Colors.transparent, : Colors.transparent,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(0))), BorderRadius.all(Radius.circular(0)))),
child: Center( child: Center(
child: Icon( child: Icon(
widget.categoryIcons!.smileyIcon.icon, widget.categoryIcons!.smileyIcon.icon,
size: 22, size: 22,
color: color:
widget.selectedCategory == Category.SMILEYS widget.selectedCategory == Category.SMILEYS
? widget.categoryIcons!.smileyIcon ? widget.categoryIcons!.smileyIcon.selectedColor
.selectedColor
: widget.categoryIcons!.smileyIcon.color, : widget.categoryIcons!.smileyIcon.color,
), ),
), ),
@ -753,22 +752,23 @@ class _EmojiPickerState extends State<EmojiPicker> {
SizedBox( SizedBox(
width: categoryWidth, width: categoryWidth,
height: categoryWidth, height: categoryWidth,
child: FlatButton( child: TextButton(
padding: EdgeInsets.all(0), style: TextButton.styleFrom(
color: widget.selectedCategory == Category.ANIMALS padding: EdgeInsets.all(0),
? Colors.black12 backgroundColor: widget.selectedCategory == Category.ANIMALS
: Colors.transparent, ? Colors.black12
shape: RoundedRectangleBorder( : Colors.transparent,
borderRadius: shape: RoundedRectangleBorder(
BorderRadius.all(Radius.circular(0))), borderRadius:
BorderRadius.all(Radius.circular(0))),
),
child: Center( child: Center(
child: Icon( child: Icon(
widget.categoryIcons!.animalIcon.icon, widget.categoryIcons!.animalIcon.icon,
size: 22, size: 22,
color: color:
widget.selectedCategory == Category.ANIMALS widget.selectedCategory == Category.ANIMALS
? widget.categoryIcons!.animalIcon ? widget.categoryIcons!.animalIcon.selectedColor
.selectedColor
: widget.categoryIcons!.animalIcon.color, : widget.categoryIcons!.animalIcon.color,
), ),
), ),
@ -785,21 +785,22 @@ class _EmojiPickerState extends State<EmojiPicker> {
SizedBox( SizedBox(
width: categoryWidth, width: categoryWidth,
height: categoryWidth, height: categoryWidth,
child: FlatButton( child: TextButton(
padding: EdgeInsets.all(0), style: TextButton.styleFrom(
color: widget.selectedCategory == Category.FOODS padding: EdgeInsets.all(0),
? Colors.black12 backgroundColor: widget.selectedCategory == Category.FOODS
: Colors.transparent, ? Colors.black12
shape: RoundedRectangleBorder( : Colors.transparent,
borderRadius: shape: RoundedRectangleBorder(
BorderRadius.all(Radius.circular(0))), borderRadius:
BorderRadius.all(Radius.circular(0))),
),
child: Center( child: Center(
child: Icon( child: Icon(
widget.categoryIcons!.foodIcon.icon, widget.categoryIcons!.foodIcon.icon,
size: 22, size: 22,
color: widget.selectedCategory == Category.FOODS color: widget.selectedCategory == Category.FOODS
? widget ? widget.categoryIcons!.foodIcon.selectedColor
.categoryIcons!.foodIcon.selectedColor
: widget.categoryIcons!.foodIcon.color, : widget.categoryIcons!.foodIcon.color,
), ),
), ),
@ -817,22 +818,22 @@ class _EmojiPickerState extends State<EmojiPicker> {
SizedBox( SizedBox(
width: categoryWidth, width: categoryWidth,
height: categoryWidth, height: categoryWidth,
child: FlatButton( child: TextButton(
padding: EdgeInsets.all(0), style: TextButton.styleFrom(
color: widget.selectedCategory == Category.TRAVEL padding: EdgeInsets.all(0),
? Colors.black12 backgroundColor: widget.selectedCategory == Category.TRAVEL
: Colors.transparent, ? Colors.black12
shape: RoundedRectangleBorder( : Colors.transparent,
borderRadius: shape: RoundedRectangleBorder(
BorderRadius.all(Radius.circular(0))), borderRadius:
BorderRadius.all(Radius.circular(0))),
),
child: Center( child: Center(
child: Icon( child: Icon(
widget.categoryIcons!.travelIcon.icon, widget.categoryIcons!.travelIcon.icon,
size: 22, size: 22,
color: color: widget.selectedCategory == Category.TRAVEL
widget.selectedCategory == Category.TRAVEL ? widget.categoryIcons!.travelIcon.selectedColor
? widget.categoryIcons!.travelIcon
.selectedColor
: widget.categoryIcons!.travelIcon.color, : widget.categoryIcons!.travelIcon.color,
), ),
), ),
@ -851,23 +852,22 @@ class _EmojiPickerState extends State<EmojiPicker> {
SizedBox( SizedBox(
width: categoryWidth, width: categoryWidth,
height: categoryWidth, height: categoryWidth,
child: FlatButton( child: TextButton(
padding: EdgeInsets.all(0), style: TextButton.styleFrom(
color: padding: EdgeInsets.all(0),
widget.selectedCategory == Category.ACTIVITIES backgroundColor: widget.selectedCategory == Category.ACTIVITIES
? Colors.black12 ? Colors.black12
: Colors.transparent, : Colors.transparent,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(0))), BorderRadius.all(Radius.circular(0))),
),
child: Center( child: Center(
child: Icon( child: Icon(
widget.categoryIcons!.activityIcon.icon, widget.categoryIcons!.activityIcon.icon,
size: 22, size: 22,
color: widget.selectedCategory == color: widget.selectedCategory == Category.ACTIVITIES
Category.ACTIVITIES ? widget.categoryIcons!.activityIcon.selectedColor
? widget.categoryIcons!.activityIcon
.selectedColor
: widget.categoryIcons!.activityIcon.color, : widget.categoryIcons!.activityIcon.color,
), ),
), ),
@ -888,22 +888,22 @@ class _EmojiPickerState extends State<EmojiPicker> {
SizedBox( SizedBox(
width: categoryWidth, width: categoryWidth,
height: categoryWidth, height: categoryWidth,
child: FlatButton( child: TextButton(
padding: EdgeInsets.all(0), style: TextButton.styleFrom(
color: widget.selectedCategory == Category.OBJECTS padding: EdgeInsets.all(0),
? Colors.black12 backgroundColor: widget.selectedCategory == Category.OBJECTS
: Colors.transparent, ? Colors.black12
shape: RoundedRectangleBorder( : Colors.transparent,
borderRadius: shape: RoundedRectangleBorder(
BorderRadius.all(Radius.circular(0))), borderRadius:
BorderRadius.all(Radius.circular(0))),
),
child: Center( child: Center(
child: Icon( child: Icon(
widget.categoryIcons!.objectIcon.icon, widget.categoryIcons!.objectIcon.icon,
size: 22, size: 22,
color: color: widget.selectedCategory == Category.OBJECTS
widget.selectedCategory == Category.OBJECTS ? widget.categoryIcons!.objectIcon.selectedColor
? widget.categoryIcons!.objectIcon
.selectedColor
: widget.categoryIcons!.objectIcon.color, : widget.categoryIcons!.objectIcon.color,
), ),
), ),
@ -924,22 +924,22 @@ class _EmojiPickerState extends State<EmojiPicker> {
SizedBox( SizedBox(
width: categoryWidth, width: categoryWidth,
height: categoryWidth, height: categoryWidth,
child: FlatButton( child: TextButton(
padding: EdgeInsets.all(0), style: TextButton.styleFrom(
color: widget.selectedCategory == Category.SYMBOLS padding: EdgeInsets.all(0),
? Colors.black12 backgroundColor: widget.selectedCategory == Category.SYMBOLS
: Colors.transparent, ? Colors.black12
shape: RoundedRectangleBorder( : Colors.transparent,
borderRadius: shape: RoundedRectangleBorder(
BorderRadius.all(Radius.circular(0))), borderRadius:
BorderRadius.all(Radius.circular(0))),
),
child: Center( child: Center(
child: Icon( child: Icon(
widget.categoryIcons!.symbolIcon.icon, widget.categoryIcons!.symbolIcon.icon,
size: 22, size: 22,
color: color: widget.selectedCategory == Category.SYMBOLS
widget.selectedCategory == Category.SYMBOLS ? widget.categoryIcons!.symbolIcon.selectedColor
? widget.categoryIcons!.symbolIcon
.selectedColor
: widget.categoryIcons!.symbolIcon.color, : widget.categoryIcons!.symbolIcon.color,
), ),
), ),
@ -961,21 +961,22 @@ class _EmojiPickerState extends State<EmojiPicker> {
SizedBox( SizedBox(
width: categoryWidth, width: categoryWidth,
height: categoryWidth, height: categoryWidth,
child: FlatButton( child: TextButton(
padding: EdgeInsets.all(0), style: TextButton.styleFrom(
color: widget.selectedCategory == Category.FLAGS padding: EdgeInsets.all(0),
? Colors.black12 backgroundColor: widget.selectedCategory == Category.FLAGS
: Colors.transparent, ? Colors.black12
shape: RoundedRectangleBorder( : Colors.transparent,
borderRadius: shape: RoundedRectangleBorder(
BorderRadius.all(Radius.circular(0))), borderRadius:
BorderRadius.all(Radius.circular(0))),
),
child: Center( child: Center(
child: Icon( child: Icon(
widget.categoryIcons!.flagIcon.icon, widget.categoryIcons!.flagIcon.icon,
size: 22, size: 22,
color: widget.selectedCategory == Category.FLAGS color: widget.selectedCategory == Category.FLAGS
? widget ? widget.categoryIcons!.flagIcon.selectedColor
.categoryIcons!.flagIcon.selectedColor
: widget.categoryIcons!.flagIcon.color, : widget.categoryIcons!.flagIcon.color,
), ),
), ),

Loading…
Cancel
Save