104 lines
2.7 KiB
Dart
104 lines
2.7 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'icon_utils.dart';
|
|
import 'my_color.dart';
|
|
|
|
class MyButton extends RaisedButton {
|
|
MyButton.delete({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.delete,
|
|
textColor: Colors.white,
|
|
child: child ?? const Text('Delete'),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
MyButton.cancel({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.cancel,
|
|
child: child ?? const Text('Cancel'),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
MyButton.edit({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.edit,
|
|
child: child ?? const Text('Edit'),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
MyButton.save({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.save,
|
|
child: child ?? const Text('Save'),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
MyButton.add({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.add,
|
|
child: child ?? const Text('Add'),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
MyButton.copy({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.copy,
|
|
child: child ?? MyIcon.copy,
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
MyButton.navigate({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.navigate,
|
|
child: child ?? const Text('Navigate'),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
MyButton.detail({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.detail,
|
|
textColor: Colors.white,
|
|
child: child ?? const Text('Detail'),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
MyButton.log({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.log,
|
|
textColor: Colors.white,
|
|
child: child ?? const Text('Log Entries'),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
MyButton.activity({Widget child, VoidCallback onPressed})
|
|
: super(
|
|
color: MyColor.activity,
|
|
textColor: Colors.white,
|
|
child: child ?? const Text('Activity'),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
static ButtonStyle raisedButtonStyle = ElevatedButton.styleFrom(
|
|
onPrimary: Colors.black87,
|
|
primary: Colors.grey[300],
|
|
minimumSize: const Size(88, 36),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
shape: const RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(2)),
|
|
),
|
|
);
|
|
|
|
static ButtonStyle flatButtonStyle = TextButton.styleFrom(
|
|
primary: Colors.black87,
|
|
minimumSize: const Size(88, 36),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
shape: const RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(2.0)),
|
|
),
|
|
);
|
|
|
|
|
|
}
|