refactor: common styles

This commit is contained in:
Rongjian Zhang
2019-10-02 16:09:54 +08:00
parent 141b80adaa
commit e6a6b026f6
24 changed files with 64 additions and 60 deletions

View File

@@ -12,8 +12,6 @@ import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
export 'package:flutter_vector_icons/flutter_vector_icons.dart';
final monospaceFont = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME:
class StorageKeys {
static const accounts = 'accounts';
static const account = 'account';
@@ -22,6 +20,13 @@ class StorageKeys {
static const newsFilter = 'news.filter';
}
class CommonStyle {
static const padding = EdgeInsets.all(12);
static const border = BorderView();
static const verticalGap = SizedBox(height: 18);
static final monospace = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME:
}
Color convertColor(String cssHex) {
if (cssHex == null) {
return Color(0xffcccccc); // Default color
@@ -124,9 +129,6 @@ bool isNotNullOrEmpty(String text) {
return text != null && text.isNotEmpty;
}
const borderView = BorderView();
const verticalGap = SizedBox(height: 18);
String getBranchQueryKey(String branch, {bool withParams = false}) {
if (branch == null) return 'defaultBranchRef';
return 'ref' + (withParams ? '(qualifiedName: "$branch")' : '');
@@ -155,7 +157,7 @@ class PrimerBranchName extends StatelessWidget {
color: PrimerColors.blue500,
fontSize: 12,
height: 1,
fontFamily: monospaceFont,
fontFamily: CommonStyle.monospace,
),
),
);
@@ -171,5 +173,3 @@ launchUrl(String url) async {
// TODO: fallback
}
}
const commonItemPadding = EdgeInsets.all(12);