mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-04-28 18:39:26 -05:00
feat: inbox screen
This commit is contained in:
@@ -18,7 +18,9 @@ class TimeAgo {
|
||||
double diff =
|
||||
(DateTime.now().millisecondsSinceEpoch - time.millisecondsSinceEpoch) /
|
||||
1000;
|
||||
if (diff < 3600) {
|
||||
if (diff < 0) {
|
||||
return 'in the future';
|
||||
} else if (diff < 3600) {
|
||||
return _pluralize(diff / 60, 'minute');
|
||||
} else if (diff < 86400) {
|
||||
return _pluralize(diff / 3600, 'hour');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
|
||||
import '../providers/settings.dart';
|
||||
import '../screens/screens.dart';
|
||||
export 'github.dart';
|
||||
export 'octicons.dart';
|
||||
@@ -14,6 +14,49 @@ Color convertColor(String cssHex) {
|
||||
return Color(int.parse('ff' + cssHex, radix: 16));
|
||||
}
|
||||
|
||||
class Option<T> {
|
||||
final T value;
|
||||
final Widget widget;
|
||||
Option({this.value, this.widget});
|
||||
}
|
||||
|
||||
Future<T> showOptions<T>(BuildContext context, List<Option<T>> options) {
|
||||
var builder = (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
actions: options.map((option) {
|
||||
return CupertinoDialogAction(
|
||||
child: option.widget,
|
||||
onPressed: () {
|
||||
Navigator.pop(context, option.value);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
};
|
||||
|
||||
switch (SettingsProvider.of(context).layout) {
|
||||
case LayoutMap.cupertino:
|
||||
return showCupertinoDialog<T>(
|
||||
context: context,
|
||||
builder: builder,
|
||||
);
|
||||
default:
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
PopupMenuItem(child: Text('a')),
|
||||
PopupMenuItem(child: Text('b')),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
TextSpan createLinkSpan(BuildContext context, String text, Function handle) {
|
||||
return TextSpan(
|
||||
text: text,
|
||||
|
||||
Reference in New Issue
Block a user