IOptButton.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import 'dart:io';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:neofilemanager/Item/Mode.dart';
  5. import 'package:neofilemanager/OperationButtom/IOperateButtonBusiness.dart';
  6. abstract class IOptButton implements IOptButtonBusiness {
  7. int cardColor = 0x22ffffff;
  8. FileSystemEntity file;
  9. int type;
  10. BuildContext context;
  11. Directory parentDir; //父目录
  12. List<FileSystemEntity> leftFiles = []; //左列的文件
  13. List<FileSystemEntity> rightFiles = []; //右列的文件
  14. Mode mode; // 接收传递过来的状态,用与判断执行何种操作
  15. ValueNotifier<bool> uiShouldChange; // 用来判断是否需要对UI重新刷新
  16. IOptButton(this.context, this.file, this.type,
  17. {this.leftFiles, this.rightFiles, this.mode, this.uiShouldChange});
  18. // 构建按钮的模板, 只有触发的方法不同
  19. Widget returnButton() {
  20. return Container(
  21. width: 170,
  22. child: Card(
  23. elevation: 0,
  24. color: Color(cardColor),
  25. margin: EdgeInsets.only(left: 5, right: 5, bottom: 20),
  26. child: InkWell(
  27. child: Center(
  28. child: Padding(
  29. padding: EdgeInsets.all(10),
  30. child: Text(titleText, style: TextStyle(color: color)),
  31. ),
  32. ),
  33. onTap: () {
  34. Navigator.pop(context);
  35. fun(file, type);
  36. },
  37. ),
  38. ),
  39. );
  40. }
  41. }