Commit code. Update time: 2023-06-25
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class StringUtils {
|
||||
static bool isNullOrEmpty(String? str) {
|
||||
return str == null || str.isEmpty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Colours {
|
||||
static const Color text_dark = Color(0xFF333333);
|
||||
static const Color text_normal = Color(0xFF666666);
|
||||
static const Color text_gray = Color(0xFF888888);
|
||||
|
||||
static const Color gray_33 = Color(0xFF333333);
|
||||
static const Color gray_66 = Color(0xFF666666);
|
||||
static const Color gray_88 = Color(0xFF888888);
|
||||
static const Color gray_99 = Color(0xFF999999);
|
||||
static const Color gray_5A = Color(0xFF5A5A5A);
|
||||
|
||||
static const Color blue_main = Color(0xFF1890FF);
|
||||
static const Color indexlabel_main = Color(0xFF757575);
|
||||
|
||||
static const Color divider = Color(0xFFF6F6F6);
|
||||
static const Color divider2 = Color(0xFFD1D1D1);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Global {
|
||||
static const baseUrl = 'https://api.dcgvc.com/';
|
||||
|
||||
static GlobalKey<NavigatorState> navigatorState = GlobalKey<NavigatorState>();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export 'dart:async';
|
||||
// export 'dart:convert';
|
||||
// export 'dart:io';
|
||||
|
||||
export '../utils/message_util.dart';
|
||||
export 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
export '../utils/sp_util.dart';
|
||||
export '../http/api/apis.dart';
|
||||
export '../http/http_utils.dart';
|
||||
export './colours.dart';
|
||||
export './styles.dart';
|
||||
export 'global.dart';
|
||||
export 'StringUtils.dart';
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'dart:ui' as ui show window;
|
||||
|
||||
class Screen {
|
||||
static double get width {
|
||||
MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
|
||||
return mediaQuery.size.width;
|
||||
}
|
||||
|
||||
static double get height {
|
||||
MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
|
||||
return mediaQuery.size.height;
|
||||
}
|
||||
|
||||
static double get scale {
|
||||
MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
|
||||
return mediaQuery.devicePixelRatio;
|
||||
}
|
||||
|
||||
static double get textScaleFactor {
|
||||
MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
|
||||
return mediaQuery.textScaleFactor;
|
||||
}
|
||||
|
||||
static double get navigationBarHeight {
|
||||
MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
|
||||
return mediaQuery.padding.top + kToolbarHeight;
|
||||
}
|
||||
|
||||
static double get topSafeHeight {
|
||||
MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
|
||||
if (mediaQuery.padding.top <= 0) {
|
||||
return 24.0;
|
||||
}
|
||||
return mediaQuery.padding.top;
|
||||
}
|
||||
|
||||
static double get bottomSafeHeight {
|
||||
MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
|
||||
return mediaQuery.padding.bottom;
|
||||
}
|
||||
|
||||
static bool get isHorizontal {
|
||||
MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
|
||||
return mediaQuery.size.width > mediaQuery.size.height;
|
||||
}
|
||||
|
||||
static updateStatusBarStyle(SystemUiOverlayStyle style) {
|
||||
SystemChrome.setSystemUIOverlayStyle(style);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import './colours.dart';
|
||||
|
||||
class TextStyles {
|
||||
static TextStyle bigTitle = TextStyle(
|
||||
fontSize: Dimens.font_sp24,
|
||||
color: Colours.text_dark,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
static TextStyle listTitle = TextStyle(
|
||||
fontSize: Dimens.font_sp16,
|
||||
color: Colours.text_dark,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
static TextStyle labelTitle = TextStyle(
|
||||
fontSize: Dimens.font_sp18,
|
||||
color: Colours.text_dark,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
static TextStyle listContent = TextStyle(
|
||||
fontSize: Dimens.font_sp14,
|
||||
color: Colours.text_normal,
|
||||
);
|
||||
static TextStyle listContentBlack = TextStyle(
|
||||
fontSize: Dimens.font_sp14,
|
||||
color: Colours.text_dark,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
static TextStyle listExtra = TextStyle(
|
||||
fontSize: Dimens.font_sp12,
|
||||
color: Colours.text_gray,
|
||||
);
|
||||
static TextStyle listSmallExtra = TextStyle(
|
||||
fontSize: Dimens.font_sp10,
|
||||
color: Colours.gray_66,
|
||||
);
|
||||
static TextStyle hugeTitle = TextStyle(
|
||||
fontSize: Dimens.font_sp30,
|
||||
color: Colours.text_dark,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
}
|
||||
|
||||
class Decorations {
|
||||
static Decoration bottom = BoxDecoration(
|
||||
border: Border(bottom: BorderSide(width: 0.33, color: Colours.divider)));
|
||||
}
|
||||
|
||||
/// 间隔
|
||||
class Gaps {
|
||||
/// 水平间隔
|
||||
static Widget hGap5 = new SizedBox(width: Dimens.gap_dp5);
|
||||
static Widget hGap15 = new SizedBox(width: Dimens.gap_dp15);
|
||||
static Widget hGap10 = new SizedBox(width: Dimens.gap_dp10);
|
||||
static Widget hGap8 = new SizedBox(width: Dimens.gap_dp8);
|
||||
static Widget hGap20 = new SizedBox(width: Dimens.gap_dp20);
|
||||
|
||||
/// 垂直间隔
|
||||
static Widget vGap5 = new SizedBox(height: Dimens.gap_dp5);
|
||||
static Widget vGap10 = new SizedBox(height: Dimens.gap_dp10);
|
||||
static Widget vGap15 = new SizedBox(height: Dimens.gap_dp15);
|
||||
static Widget vGap20 = new SizedBox(height: Dimens.gap_dp20);
|
||||
}
|
||||
|
||||
class Dimens {
|
||||
static const double font_sp8 = 8;
|
||||
static const double font_sp10 = 10;
|
||||
static const double font_sp12 = 12;
|
||||
static const double font_sp14 = 14;
|
||||
static const double font_sp16 = 16;
|
||||
static const double font_sp18 = 18;
|
||||
static const double font_sp20 = 20;
|
||||
static const double font_sp24 = 24;
|
||||
static const double font_sp26 = 26;
|
||||
static const double font_sp30 = 30;
|
||||
|
||||
static const double gap_dp3 = 3;
|
||||
static const double gap_dp5 = 5;
|
||||
static const double gap_dp8 = 8;
|
||||
static const double gap_dp10 = 10;
|
||||
static const double gap_dp12 = 12;
|
||||
static const double gap_dp15 = 15;
|
||||
static const double gap_dp16 = 16;
|
||||
static const double gap_dp20 = 20;
|
||||
static const double gap_dp25 = 25;
|
||||
static const double gap_dp30 = 30;
|
||||
|
||||
static const double btn_h_48 = 48;
|
||||
static const double item_h_42 = 42;
|
||||
|
||||
static const double border_width = 0.33;
|
||||
}
|
||||
Reference in New Issue
Block a user