Deleted 移除无用的文件
This commit is contained in:
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -2,7 +2,7 @@
|
||||
path = libraries/LGLibrary
|
||||
url = git@git.ghzs.com:android/common-library.git
|
||||
branch = master
|
||||
[submodule "flutter-module"]
|
||||
path = flutter-module
|
||||
[submodule "assistant-flutter"]
|
||||
path = assistant-flutter
|
||||
url = git@git.ghzs.com:halo/android/flutter-module.git
|
||||
branch = dev
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
//@dart=2.9
|
||||
import 'package:assistant/common/assistant_routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_boost/flutter_boost.dart';
|
||||
|
||||
class AssistantApp extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => AssistantAppState();
|
||||
}
|
||||
|
||||
class AssistantAppState extends State<AssistantApp> {
|
||||
|
||||
Route<dynamic> _buildRoute(RouteSettings settings, String uniqueId) {
|
||||
FlutterBoostRouteFactory func = routes[settings.name];
|
||||
return func?.call(settings, uniqueId);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => FlutterBoostApp(_buildRoute);
|
||||
}
|
||||
@ -1,113 +0,0 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart' hide ImageProvider;
|
||||
import 'package:flutter/material.dart' hide ImageProvider;
|
||||
import 'package:flutter_glide/flutter_glide.dart';
|
||||
|
||||
class AssistantAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
static const double APP_BAR_SIZE = 48;
|
||||
static const String DEFAULT_NAVIGATION_ICON = "R.drawable.ic_bar_back";
|
||||
|
||||
// 标题栏
|
||||
final String title;// 标题文案
|
||||
final double? titleSize;// 标题字体大小
|
||||
final Color? titleColor;// 标题字体颜色
|
||||
final TextStyle? titleStyle;// 标题字体样式
|
||||
final Widget? titleWidget;// 自定义标题控件
|
||||
|
||||
// 导航按钮
|
||||
final ImageProvider? navigationIcon;// 导航按钮图标
|
||||
final double? navigationMarginStart;// 导航按钮左间隔
|
||||
final double? navigationIconWidth;// 导航按钮宽度
|
||||
final double? navigationIconHeight;// 导航按钮高度
|
||||
final Widget? navigationWidget;// 自定导航按钮控件
|
||||
final VoidCallback? onNavigationPressed;// 导航按钮点击事件
|
||||
|
||||
// 菜单栏
|
||||
final Widget? menuWidget; // 自定义菜单控件
|
||||
final double? menuMarginEnd; // 菜单右间隔
|
||||
final VoidCallback? onMenuPressed;// 菜单点击事件
|
||||
|
||||
|
||||
|
||||
const AssistantAppBar({
|
||||
Key? key,
|
||||
required this.title,
|
||||
this.titleSize,
|
||||
this.titleColor,
|
||||
this.titleStyle,
|
||||
this.titleWidget,
|
||||
this.navigationWidget,
|
||||
this.navigationIcon,
|
||||
this.onNavigationPressed,
|
||||
this.navigationIconWidth,
|
||||
this.navigationIconHeight,
|
||||
this.navigationMarginStart,
|
||||
this.menuWidget,
|
||||
this.menuMarginEnd,
|
||||
this.onMenuPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 导航栏
|
||||
Widget navigationWidget = this.navigationWidget ??
|
||||
Glide(
|
||||
navigationIcon ?? const DrawableImageProvider(DEFAULT_NAVIGATION_ICON),
|
||||
width: navigationIconWidth ?? 24,
|
||||
height: navigationIconHeight ?? 24
|
||||
);
|
||||
if (onNavigationPressed != null)
|
||||
navigationWidget = IconButton(
|
||||
onPressed: onNavigationPressed,
|
||||
icon: navigationWidget,
|
||||
splashRadius: 21,
|
||||
);
|
||||
navigationWidget = Positioned(
|
||||
left: navigationMarginStart??0,
|
||||
child: navigationWidget
|
||||
);
|
||||
|
||||
// 标题栏
|
||||
TextStyle? appBarTextStyle = AppBarTheme.of(context).titleTextStyle;
|
||||
Widget titleWidget = this.titleWidget ?? Text(
|
||||
this.title,
|
||||
style: this.titleStyle??TextStyle(
|
||||
color: this.titleColor??Colors.black,
|
||||
fontSize: this.titleSize??15,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: appBarTextStyle?.fontFamily
|
||||
),
|
||||
);
|
||||
|
||||
// 菜单栏
|
||||
Widget menuWidget = Container();
|
||||
if (this.menuWidget != null) {
|
||||
menuWidget = Positioned(
|
||||
right: this.menuMarginEnd??15,
|
||||
child: this.onMenuPressed != null ? GestureDetector(
|
||||
onTap: this.onMenuPressed,
|
||||
child: this.menuWidget
|
||||
) : this.menuWidget!
|
||||
);
|
||||
}
|
||||
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
height: APP_BAR_SIZE,
|
||||
alignment: Alignment.center,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
navigationWidget,
|
||||
titleWidget,
|
||||
menuWidget
|
||||
],
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => Size.fromHeight(APP_BAR_SIZE);
|
||||
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
//@dart=2.9
|
||||
import 'package:flutter_boost/flutter_boost.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
//这里要特别注意,如果你的工程里已经有一个继承自WidgetsFlutterBinding的自定义Binding,则只需要将其with上BoostFlutterBinding
|
||||
//如果你的工程没有自定义的Binding,则可以参考这个CustomFlutterBinding的做法
|
||||
//BoostFlutterBinding用于接管Flutter App的生命周期,必须得接入的
|
||||
class AssistantFlutterBinding extends WidgetsFlutterBinding with BoostFlutterBinding {}
|
||||
@ -1,10 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class AssistantColors {
|
||||
AssistantColors._();
|
||||
|
||||
static const color_primary = const Color(0xFF1383EB);
|
||||
|
||||
static const color_666666 = const Color(0xFF666666);
|
||||
static const color_eeeeee = const Color(0xFFEEEEEE);
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
//@dart=2.9
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_boost/flutter_boost.dart';
|
||||
import 'package:assistant/pages/feedback/feedback_page.dart';
|
||||
|
||||
const String FEED_BACK = "feedback";
|
||||
|
||||
Map<String, FlutterBoostRouteFactory> get routes => {
|
||||
"/": (settings, uniqueId) {
|
||||
return PageRouteBuilder<dynamic>(
|
||||
settings: settings,
|
||||
pageBuilder: (_, __, ___) {
|
||||
return FeedbackPage();
|
||||
});
|
||||
},
|
||||
FEED_BACK: (settings, uniqueId) {
|
||||
return PageRouteBuilder<dynamic>(
|
||||
settings: settings,
|
||||
pageBuilder: (_, __, ___) {
|
||||
return FeedbackPage();
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -1,25 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AssistantSearchBar extends StatelessWidget {
|
||||
final TextEditingController? controller;
|
||||
|
||||
const AssistantSearchBar({this.controller}) : super();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
decoration: const InputDecoration(
|
||||
hintText: "请输入关键词搜索",
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
/**
|
||||
* 自定义TabIndicator
|
||||
*/
|
||||
import 'package:assistant/common/assistant_tabbar.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum TabBarIndicatorShape {
|
||||
/// 圆角方形指示器
|
||||
round,
|
||||
/// 方形指示器
|
||||
square
|
||||
}
|
||||
|
||||
/// 自定义TabBar指示器
|
||||
/// 该指示器实现了如下功能:
|
||||
/// 1.支持指示器设置固定宽度
|
||||
/// 2.支持指示器设置为圆角矩形
|
||||
/// 该TabBar指示器类已作为默认指示器类应用于[AssistantTabBar]
|
||||
class UnderlineTabIndicator extends Decoration {
|
||||
/// TabBar指示器的宽度
|
||||
/// 传空则宽度根据原生指示器的规则计算宽度
|
||||
final double? indicatorWidth;
|
||||
/// TabBar指示器的形状
|
||||
final TabBarIndicatorShape? border;
|
||||
|
||||
const UnderlineTabIndicator({
|
||||
this.border,
|
||||
this.indicatorWidth,
|
||||
this.borderSide = const BorderSide(
|
||||
width: 2.0,
|
||||
color: Colors.white
|
||||
),
|
||||
this.insets = EdgeInsets.zero,
|
||||
|
||||
});
|
||||
|
||||
final BorderSide borderSide;
|
||||
|
||||
final EdgeInsetsGeometry insets;
|
||||
|
||||
@override
|
||||
BoxPainter createBoxPainter([VoidCallback? onChanged]) {
|
||||
return _UnderlinePainter(this, onChanged, border: border);
|
||||
}
|
||||
|
||||
Rect _indicatorRectFor(Rect rect, TextDirection textDirection) {
|
||||
final Rect indicator = insets.resolve(textDirection).deflateRect(rect);
|
||||
final isValid = indicatorWidth != null && indicatorWidth! < indicator.width;
|
||||
final left = isValid ? indicator.left + indicatorWidth! : indicator.left;
|
||||
final width = isValid ? indicatorWidth! : indicator.width;
|
||||
return Rect.fromLTWH(
|
||||
left,
|
||||
indicator.bottom - borderSide.width,
|
||||
width,
|
||||
borderSide.width,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 自定义TabBar指示器画笔
|
||||
class _UnderlinePainter extends BoxPainter {
|
||||
final UnderlineTabIndicator decoration;
|
||||
|
||||
final TabBarIndicatorShape? border;
|
||||
|
||||
_UnderlinePainter(this.decoration, VoidCallback? callback, {this.border}): super(callback);
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
|
||||
final Rect rect = offset & configuration.size!;
|
||||
final TextDirection textDirection = configuration.textDirection!;
|
||||
final Rect indicator = decoration._indicatorRectFor(rect, textDirection).deflate(decoration.borderSide.width / 2.0);
|
||||
final TabBarIndicatorShape border = this.border ?? TabBarIndicatorShape.round;
|
||||
final StrokeCap strokeCap = border == TabBarIndicatorShape.round ? StrokeCap.round : StrokeCap.square;
|
||||
final Paint paint = decoration.borderSide.toPaint()..strokeCap = strokeCap;
|
||||
canvas.drawLine(indicator.bottomLeft, indicator.bottomRight, paint);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,106 +0,0 @@
|
||||
/**
|
||||
* 通用TabBar封装
|
||||
* 在原生TabBar基础上加入Halo的设计风格
|
||||
*/
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart' hide UnderlineTabIndicator;
|
||||
import 'package:assistant/common/assistant_colors.dart';
|
||||
import 'package:assistant/common/assistant_tab_indicator.dart';
|
||||
|
||||
class AssistantTabBar extends StatelessWidget {
|
||||
|
||||
static const DEFAULT_LABEL_STYLE = const TextStyle(
|
||||
fontWeight: FontWeight.bold
|
||||
);
|
||||
|
||||
static const DEFAULT_UNSELECTED_LABEL_STYLE = const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
);
|
||||
|
||||
static const DEFAULT_DECORATION = const BoxDecoration(
|
||||
border: const Border(
|
||||
bottom: const BorderSide(
|
||||
width: 1.0,
|
||||
color: AssistantColors.color_eeeeee
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
final List<Widget> tabs;
|
||||
final TabController? controller;
|
||||
final Color? labelColor;
|
||||
final TextStyle? labelStyle;
|
||||
final Color? unselectedLabelColor;
|
||||
final TextStyle? unselectedLabelStyle;
|
||||
final Decoration? indicator;
|
||||
final TabBarIndicatorSize? indicatorSize;
|
||||
final Color? indicatorColor;
|
||||
|
||||
/// TabBar的边距
|
||||
final Decoration? border;
|
||||
|
||||
/// 指示器的宽度
|
||||
/// 默认情况下为空,则会根据[TabBarIndicatorSize]确定指示器宽度大小
|
||||
/// 否则指示器的宽度为传入的值大小
|
||||
final double? indicatorWidth;
|
||||
|
||||
/// 指示器边角的形状
|
||||
final TabBarIndicatorShape? indicatorBorder;
|
||||
|
||||
final double? indicatorWeight;
|
||||
final EdgeInsetsGeometry? indicatorPadding;
|
||||
|
||||
const AssistantTabBar({
|
||||
Key? key,
|
||||
required this.tabs,
|
||||
this.controller,
|
||||
this.border,
|
||||
this.labelColor,
|
||||
this.labelStyle,
|
||||
this.unselectedLabelColor,
|
||||
this.unselectedLabelStyle,
|
||||
this.indicator,
|
||||
this.indicatorColor,
|
||||
this.indicatorSize,
|
||||
this.indicatorBorder,
|
||||
this.indicatorWidth,
|
||||
this.indicatorWeight,
|
||||
this.indicatorPadding,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double indicatorWeight = this.indicatorWeight ?? 3.0;
|
||||
double indicatorWidth = this.indicatorWidth ?? 20;
|
||||
Color indicatorColor = this.indicatorColor ?? Theme.of(context).indicatorColor;
|
||||
Decoration indicator = this.indicator ?? UnderlineTabIndicator(
|
||||
borderSide: BorderSide(
|
||||
width: indicatorWeight,
|
||||
color: indicatorColor,
|
||||
),
|
||||
border: indicatorBorder,
|
||||
indicatorWidth: indicatorWidth
|
||||
);
|
||||
return Theme(
|
||||
data: ThemeData(
|
||||
splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明
|
||||
highlightColor: Colors.transparent // 点击时的背景高亮颜色设置为透明
|
||||
),
|
||||
child: DecoratedBox(
|
||||
decoration: border ?? DEFAULT_DECORATION,
|
||||
child: TabBar(
|
||||
tabs: tabs,
|
||||
indicator: indicator,
|
||||
controller: controller,
|
||||
labelStyle: labelStyle ?? DEFAULT_LABEL_STYLE,// Tab选中字体样式
|
||||
labelColor: labelColor ?? AssistantColors.color_primary,// Tab选中字体颜色
|
||||
unselectedLabelColor: unselectedLabelColor ?? AssistantColors.color_666666,// Tab未选中字体颜色
|
||||
unselectedLabelStyle: unselectedLabelStyle ?? DEFAULT_UNSELECTED_LABEL_STYLE,// Tab未选中字体样式
|
||||
indicatorSize: indicatorSize ?? TabBarIndicatorSize.label,// 指示器宽度计算模式
|
||||
indicatorPadding: indicatorPadding ?? EdgeInsets.zero// 指示器内边距
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AssistantTabBarView extends StatelessWidget {
|
||||
final bool flex;
|
||||
final List<Widget> children;
|
||||
final TabController? controller;
|
||||
|
||||
const AssistantTabBarView({
|
||||
this.flex: true,
|
||||
this.controller,
|
||||
required this.children
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget child = TabBarView(
|
||||
controller: controller,
|
||||
children: children
|
||||
);
|
||||
if (flex) child = Flexible(child: child);
|
||||
return child;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user