Commit faeec501 authored by 林生雨's avatar 林生雨

Initial commit

parents
.DS_Store
.dart_tool/
.packages
.pub/
.idea/
.vagrant/
.sconsign.dblite
.svn/
*.swp
profile
DerivedData/
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
build/
.android/
.ios/
.flutter-plugins
.flutter-plugins-dependencies
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# gm_flutter
A new flutter module project.
## Getting Started
For help getting started with Flutter, view our online
[documentation](https://flutter.dev/).
flutter packages get
flutter packages pub run build_runner clean
flutter packages pub run build_runner build --delete-conflicting-outputs
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
\ No newline at end of file
/*
* @author lsy
* @date 2020/6/24
**/
import 'package:flutter_common/Annotations/RouterBaser.dart';
import 'package:flutter_common/Annotations/anno/Router.dart';
import 'package:flutter_common/Annotations/anno/RouterCenter.dart';
import 'package:gm_flutter/ClueModel/ClueRouterImpl.dart';
@Router("ClueRouter",ClueRouterImpl,true)
abstract class ClueRouter implements RouterBaser{
}
\ No newline at end of file
/*
* @author lsy
* @date 2020/6/24
**/
import 'package:gm_flutter/ClueModel/ClueRouter.dart';
class ClueRouterImpl implements ClueRouter{
}
\ No newline at end of file
/*
* @author lsy
* @date 2020/6/20
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class DemoPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return DemoState();
}
}
class DemoState extends State<DemoPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text("ww"),
),
body: Stack(
children: <Widget>[
Stack(
children: <Widget>[
Column(
children: <Widget>[
Container(
width: 50,
height: 50,
color: Colors.redAccent,
)
],
)
],
)
],
),
);
}
}
/*
* @author lsy
* @date 2019-10-15
**/
library GMBase;
export 'base/BaseComponent.dart';
export 'base/BaseUtil.dart';
export 'net/Api.dart';
export 'net/DioUtil.dart';
export 'picker/loadingPicker.dart';
export 'util/DartUtil.dart';
/*
* @author lsy
* @date 2019-10-13
**/
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_common/commonModel/eventbus/GlobalEventBus.dart';
import 'package:flutter_common/commonModel/view/iOSLoading.dart';
import 'package:flutter_svg/svg.dart';
import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
double SCREENWIDTH;
double SCREENHEIGHT;
AppBar baseAppBar(
{String title,
List<Widget> action,
bool centerTitle,
VoidCallback backClick,
Color backgroundColor,
Key key,
bool showBack = true,
double elevation = 0.0,
Widget titleWidget = null}) {
return _baseAppBarChangeTitle(
title: title == null
? Container()
: baseText(title, 16, Color(0xff323232)),
action: action,
centerTitle: centerTitle,
backClick: backClick,
backgroundColor: backgroundColor,
key: key,
showBack: showBack,
elevation: elevation,
titleWidget: titleWidget);
}
AppBar _baseAppBarChangeTitle(
{Widget title,
List<Widget> action,
bool centerTitle,
VoidCallback backClick,
Color backgroundColor,
Key key,
bool showBack,
double elevation,
Widget titleWidget}) {
return AppBar(
key: key,
// backgroundColor:
// backgroundColor == null ? ALColors.ColorFFFFFF : backgroundColor,
title: titleWidget == null ? title : titleWidget,
centerTitle: centerTitle,
elevation: elevation,
leading: showBack
? GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: backClick,
child: Hero(
tag: "left_arrow",
child: Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(left: 10),
child: Container(
width: 30,
height: 30,
child: Image.asset(
"images/left_arrow.png",
color: Color(0xff323232),
),
))),
)
: Container(),
actions: action == null ? List<Widget>() : action,
);
}
Text baseText(String text, double fontSize, Color color, {bool bold = false}) {
return Text(
text,
textScaleFactor: 1.0,
style: TextStyle(
decoration: TextDecoration.none,
fontSize: fontSize,
color: color,
fontStyle: FontStyle.normal,
fontWeight: bold ? FontWeight.w500 : FontWeight.w400),
);
}
Widget baseDivide(double padding) {
return Container(
height: 0.5,
width: double.maxFinite,
margin: EdgeInsets.only(left: padding, right: padding),
color: Color(0xffE5E5E5),
);
}
Widget baseDivideWidth(double width, double padding) {
return Container(
height: 0.5,
width: width,
margin: EdgeInsets.only(left: padding, right: padding),
color: Color(0xffE5E5E5),
);
}
Widget loadingItem({bool needBackground = false}) {
return Center(
child: Container(
width: 77,
height: 77,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: needBackground ? Colors.black : Colors.transparent),
alignment: Alignment.center,
child: MyCupertinoActivityIndicator(
backColor: needBackground ? Colors.white : Colors.black,
),
));
}
Widget netErrorItem() {}
Widget errorItem(VoidCallback retry, {String errorText, String retryText}) {
return Container(
width: SCREENWIDTH,
height: SCREENHEIGHT,
color: Colors.white,
alignment: Alignment.center,
child: Container(
height: SCREENHEIGHT,
child: Container(
margin: EdgeInsets.only(top: 70),
width: 175,
height: 249,
child: Stack(
children: <Widget>[
Positioned(
left: 0,
top: 0,
child: Container(
width: 175,
height: 199,
child: Image.asset("assets/error.png"),
),
),
Positioned(
left: 0,
top: 166,
child: Container(
width: 175,
alignment: Alignment.center,
child: baseText(errorText ?? "网络错误", 15, Color(0xff666666)),
),
),
Positioned(
top: 216,
left: 12,
child: Container(
width: 150,
height: 33,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22.5),
color: Color(0xff51CDC7)),
alignment: Alignment.center,
child: baseText(retryText ?? "重新加载", 16, Colors.white),
).gestureDetector(() {
retry();
}),
)
],
),
)));
}
//TODO
Widget refreshViewTop(RefreshController refreshController, VoidCallback refresh,
Widget topFix, Widget List) {
return SmartRefresher(
enablePullDown: true,
enablePullUp: false,
header: WaterDropMaterialHeader(
backgroundColor: Color.fromARGB(255, 236, 236, 236),
),
controller: refreshController,
onRefresh: refresh,
child: CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(
child: topFix,
),
List
],
));
}
Widget refreshViewbottom(RefreshController refreshController,
VoidCallback refresh, Widget topFix, Widget List) {
return SmartRefresher(
enablePullDown: true,
enablePullUp: false,
header: WaterDropMaterialHeader(
backgroundColor: Color.fromARGB(255, 236, 236, 236),
),
controller: refreshController,
onRefresh: refresh,
child: CustomScrollView(
slivers: <Widget>[
List,
// SliverToBoxAdapter(
// child: topFix,
// ),
],
));
}
Widget baseTextField(TextEditingController editingController,
TextInputType inputType, String hintText) {
return TextField(
cursorColor: Color(0xff20BDBB),
style: TextStyle(fontSize: 14),
decoration: InputDecoration(
hintText: hintText,
hintStyle: TextStyle(fontSize: 14, color: Color(0xffCCCCCC)),
isDense: true,
border: InputBorder.none,
contentPadding:
const EdgeInsets.symmetric(horizontal: 0.0, vertical: 17.0),
),
maxLines: 1,
enableInteractiveSelection: true,
autocorrect: false,
autofocus: true,
keyboardType: inputType,
controller: editingController,
minLines: 1,
);
}
Widget baseRedPoint(int num) {
return Container(
alignment: Alignment.center,
width: 15,
height: 15,
decoration:
BoxDecoration(shape: BoxShape.circle, color: Color(0xffFF5963)),
child: baseText("${num}", 11, Color(0xffFFFFFF)),
);
}
/*
* @author lsy
* @date 2019-12-17
**/
import 'package:flutter/material.dart';
abstract class BaseState<T extends StatefulWidget> extends State<T> {
Widget buildItem(BuildContext context);
@override
Widget build(BuildContext context) {
return WillPopScope(
child: buildItem(context),
onWillPop: () {
onWillPop();
},
);
}
void onWillPop(){
Navigator.pop(context);
}
}
/*
* @author lsy
* @date 2019-10-14
**/
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
const _miniChannle = const MethodChannel('gengmei_mini');
const bool isDebug = ! const bool.fromEnvironment("dart.vm.product");
Future backApp() async {
return await _miniChannle.invokeMethod("backApp");
}
void jumpToPage(Widget page, BuildContext context) {
Navigator.push(context, MaterialPageRoute(builder: ((context) {
return page;
})));
}
/*
* @author lsy
* @date 2020/5/29
**/
import 'package:flutter_common/Annotations/anno/ServerEntity.dart';
import 'dart:convert' as cov;
@ServerEntity()
class ConversationItemBean {
int error;
Data data;
String message;
ConversationItemBean({this.error, this.data, this.message});
ConversationItemBean.fromJson(Map<String, dynamic> json) {
error = json['error'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
if (this.data != null) {
data['data'] = this.data.toJson();
}
data['message'] = this.message;
return data;
}
}
class Data {
int targetUid;
String nickname;
List<Messages> messages;
int conversationId;
int lastReplyTime;
int createdTime;
String text;
String hospitalName;
bool isStar;
String doctorName;
DoctorInfo doctorInfo;
UserInfo userInfo;
Data(
{this.targetUid,
this.nickname,
this.messages,
this.conversationId,
this.lastReplyTime,
this.createdTime,
this.text,
this.hospitalName,
this.isStar,
this.doctorName,
this.doctorInfo,
this.userInfo});
Data.fromJson(Map<String, dynamic> json) {
targetUid = json['target_uid'];
nickname = json['nickname'];
if (json['messages'] != null) {
messages = new List<Messages>();
json['messages'].forEach((v) {
messages.add(new Messages.fromJson(v));
});
}
conversationId = json['conversation_id'];
lastReplyTime = json['last_reply_time'];
createdTime = json['created_time'];
text = json['text'];
hospitalName = json['hospital_name'];
isStar = json['is_star'];
doctorName = json['doctor_name'];
doctorInfo = json['doctor_info'] != null
? new DoctorInfo.fromJson(json['doctor_info'])
: null;
userInfo = json['user_info'] != null
? new UserInfo.fromJson(json['user_info'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['target_uid'] = this.targetUid;
data['nickname'] = this.nickname;
if (this.messages != null) {
data['messages'] = this.messages.map((v) => v.toJson()).toList();
}
data['conversation_id'] = this.conversationId;
data['last_reply_time'] = this.lastReplyTime;
data['created_time'] = this.createdTime;
data['text'] = this.text;
data['hospital_name'] = this.hospitalName;
data['is_star'] = this.isStar;
data['doctor_name'] = this.doctorName;
if (this.doctorInfo != null) {
data['doctor_info'] = this.doctorInfo.toJson();
}
if (this.userInfo != null) {
data['user_info'] = this.userInfo.toJson();
}
return data;
}
}
class PushNotifyBean {
Messages message;
int type;
PushNotifyBean({this.message, this.type});
PushNotifyBean.fromJson(Map<String, dynamic> json) {
message = json['message'] != null
? new Messages.fromJson(Map<String, dynamic>.from(json['message']))
: null;
type = json['type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.message != null) {
data['message'] = this.message.toJson();
}
data['type'] = this.type;
return data;
}
}
class Messages {
int id;
int uid;
String type;
int sendTime;
String replyTime;
String image;
String audio;
String text;
String imageThumb;
String userKey;
bool isRead;
String nickname;
String portrait;
String doctorId;
String hospitalName;
Content content;
Messages(
{this.id,
this.uid,
this.type,
this.sendTime,
this.replyTime,
this.image,
this.audio,
this.text,
this.imageThumb,
this.userKey,
this.isRead,
this.nickname,
this.portrait,
this.doctorId,
this.hospitalName,
this.content});
Messages.fromJson(Map<String, dynamic> json) {
id = json['id'];
uid = json['uid'];
type = json['type'];
sendTime = json['send_time'];
replyTime = json['reply_time'];
image = json['image'];
audio = json['audio'];
text = json['text'];
imageThumb = json['image_thumb'];
userKey = json['user_key'];
isRead = json['is_read'];
nickname = json['nickname'];
portrait = json['portrait'];
doctorId = json['doctor_id'];
hospitalName = json['hospital_name'];
if (json['content'] == null || json['content'] is Map) {
content = json['content'] != null
? new Content.fromJson(json['content'])
: null;
} else {
content = json['content'] != null
? new Content.fromJson(cov.json.decode(json['content']))
: null;
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['uid'] = this.uid;
data['type'] = this.type;
data['send_time'] = this.sendTime;
data['reply_time'] = this.replyTime;
data['image'] = this.image;
data['audio'] = this.audio;
data['text'] = this.text;
data['image_thumb'] = this.imageThumb;
data['user_key'] = this.userKey;
data['is_read'] = this.isRead;
data['nickname'] = this.nickname;
data['portrait'] = this.portrait;
data['doctor_id'] = this.doctorId;
data['hospital_name'] = this.hospitalName;
if (this.content != null) {
data['content'] = this.content.toJson();
}
return data;
}
}
class ContentImage {
String imageWide;
String image;
String imageSlimwidth;
String smallWide;
String imageThumb;
String imageHalf;
String desc;
ContentImage(
{this.imageWide,
this.image,
this.imageSlimwidth,
this.smallWide,
this.imageThumb,
this.imageHalf,
this.desc});
ContentImage.fromJson(Map<String, dynamic> json) {
imageWide = json['image_wide'];
image = json['image'];
imageSlimwidth = json['image_slimwidth'];
smallWide = json['small_wide'];
imageThumb = json['image_thumb'];
imageHalf = json['image_half'];
desc = json['desc'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['image_wide'] = this.imageWide;
data['image'] = this.image;
data['image_slimwidth'] = this.imageSlimwidth;
data['small_wide'] = this.smallWide;
data['image_thumb'] = this.imageThumb;
data['image_half'] = this.imageHalf;
data['desc'] = this.desc;
return data;
}
}
class ContentTags {
String type;
String name;
int tagId;
int id;
ContentTags({this.type, this.name, this.tagId, this.id});
ContentTags.fromJson(Map<String, dynamic> json) {
type = json['type'];
name = json['name'];
tagId = json['tag_id'];
id = json['id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['type'] = this.type;
data['name'] = this.name;
data['tag_id'] = this.tagId;
data['id'] = this.id;
return data;
}
}
class Content {
int id;
int gengmei_price;
String title;
String image;
String text;
String name;
String url;
List<ContentImage> images;
String videoPreviewUrl;
List<ContentTags> tags_new_era;
bool is_multiattribute;
String consultationRecordId;
Content(
{this.videoPreviewUrl,
this.consultationRecordId,
this.id,
this.gengmei_price,
this.tags_new_era,
this.images,
this.title,
this.image,
this.text,
this.url,
this.is_multiattribute,
this.name});
Content.fromJson(Map<String, dynamic> json) {
videoPreviewUrl = json['video_preview_url'];
consultationRecordId = json['consultation_record_id'];
id = json['id'];
name = json['name'];
if (json['images'] != null) {
images = new List<ContentImage>();
json['images'].forEach((v) {
images.add(new ContentImage.fromJson(v));
});
}
if (json['tags_new_era'] != null) {
tags_new_era = new List<ContentTags>();
json['tags_new_era'].forEach((v) {
tags_new_era.add(new ContentTags.fromJson(v));
});
}
title = json['title'];
is_multiattribute = json['is_multiattribute'];
url = json['url'];
image = json['image'];
text = json['text'];
gengmei_price = json['gengmei_price'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['video_preview_url'] = this.videoPreviewUrl;
data['consultation_record_id'] = this.consultationRecordId;
data['id'] = this.id;
data['text'] = this.text;
data['title'] = this.title;
if (this.images != null) {
data['images'] = this.images.map((v) => v.toJson()).toList();
}
if (this.tags_new_era != null) {
data['tags_new_era'] = this.tags_new_era.map((v) => v.toJson()).toList();
}
data['name'] = this.name;
data['is_multiattribute'] = this.is_multiattribute;
data['url'] = this.url;
data['gengmei_price'] = this.gengmei_price;
data['image'] = this.image;
return data;
}
}
class DoctorInfo {
String doctorName;
String doctorPortrait;
DoctorInfo({this.doctorName, this.doctorPortrait});
DoctorInfo.fromJson(Map<String, dynamic> json) {
doctorName = json['doctor_name'];
doctorPortrait = json['doctor_portrait'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['doctor_name'] = this.doctorName;
data['doctor_portrait'] = this.doctorPortrait;
return data;
}
}
class UserInfo {
String age;
String nickname;
String cityName;
int userId;
String portrait;
String birthday;
String joinTime;
String lastLogin;
UserInfo(
{this.age,
this.nickname,
this.cityName,
this.userId,
this.portrait,
this.birthday,
this.joinTime,
this.lastLogin});
UserInfo.fromJson(Map<String, dynamic> json) {
age = json['age'];
nickname = json['nickname'];
cityName = json['city_name'];
userId = json['user_id'];
portrait = json['portrait'];
birthday = json['birthday'];
joinTime = json['join_time'];
lastLogin = json['last_login'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['age'] = this.age;
data['nickname'] = this.nickname;
data['city_name'] = this.cityName;
data['user_id'] = this.userId;
data['portrait'] = this.portrait;
data['birthday'] = this.birthday;
data['join_time'] = this.joinTime;
data['last_login'] = this.lastLogin;
return data;
}
}
/*
* @author lsy
* @date 2020/5/25
**/
const LOADING = 0;
const ENDLOADING = 1;
const FAIL = 2;
class Pair<T, S> {
dynamic first;
dynamic second;
Pair(this.first, this.second);
}
/*
* @author lsy
* @date 2020/5/28
**/
import 'dart:typed_data';
class PushBean {
int newMessage = 0;
String userKey;
List<int> state = [];
String name;
int time;
String headUrl;
String content;
int doctorUserId;
bool isStarFromDoctor;
int conversation_id;
String place;
Map<int, MessageItem> messageList = {};
}
const CARD_TYPE_DARY = "CARD_TYPE_DARY";
const CARD_TYPE_NORMAL = "CARD_TYPE_NORMAL";
const CARD_TYPE_VOICE = "CARD_TYPE_VOICE";
const CARD_TYPE_PIC = "CARD_TYPE_PIC";
const CARD_TYPE_MONEY = "CARD_TYPE_MONEY";
const CARD_TYPE_BEAUTY = "CARD_TYPE_BEAUTY";
const CARD_TYPE_TIME = "CARD_TYPE_TIME";
class MessageItem {
int id;
int sendTime;
String cardType;
bool isMe;
String headUrl;
String sendState;
MessageDiary diary;
MessageNormal normal;
MessageTime time;
MessageMoney money;
MessageVoice voice;
MessageBeauty beauty;
MessageNativePic pic;
MessageItem(this.id, this.sendTime,
{this.cardType,
this.isMe,
this.pic,
this.sendState,
this.diary,
this.normal,
this.time,
this.money,
this.voice,
this.beauty,
this.headUrl});
static MessageItem buildTime(int id, int sendTime, String time) {
return MessageItem(id, sendTime,
cardType: CARD_TYPE_TIME, time: MessageTime(time));
}
static MessageItem buildNormal(
int id, int sendTime, bool isMe, String content, String url) {
return MessageItem(id, sendTime,
cardType: CARD_TYPE_NORMAL,
isMe: isMe,
headUrl: url,
normal: MessageNormal(content));
}
static MessageItem buildMeNativePic(
int id, int sendTime, String url, String nativePic, String recordPath) {
return MessageItem(id, sendTime,
cardType: CARD_TYPE_PIC,
isMe: true,
headUrl: url,
pic: MessageNativePic(null, nativePic, null, recordPath));
}
static MessageItem buildNetPic(
int id, int sendTime, bool isMe, String url, String headUrl) {
return MessageItem(id, sendTime,
cardType: CARD_TYPE_PIC,
isMe: isMe,
headUrl: headUrl,
pic: MessageNativePic(url, null, null, null));
}
static MessageItem buildBeauty(int id, int sendTime, String headUrl,
String showUrl, String title, String money, String beautyId) {
return MessageItem(id, sendTime,
cardType: CARD_TYPE_BEAUTY,
isMe: true,
headUrl: headUrl,
beauty: MessageBeauty(beautyId, showUrl, title, money));
}
static MessageItem buildMoney(
int id, int sendTime, String headUrl, String picUrl) {
return MessageItem(id, sendTime,
cardType: CARD_TYPE_MONEY,
isMe: true,
headUrl: headUrl,
money: MessageMoney(picUrl));
}
static MessageItem buildDiary(
int id,
int sendTime,
String headUrl,
String leftUrl,
String rightUrl,
String userName,
List<String> tags,
String jumpUrl) {
return MessageItem(id, sendTime,
cardType: CARD_TYPE_DARY,
isMe: true,
headUrl: headUrl,
diary: MessageDiary(leftUrl, rightUrl, userName, tags, jumpUrl));
}
static MessageItem buildVoice(int id, int sendTime, bool isMe, String headUrl,
String path, String url, String during) {
return MessageItem(id, sendTime,
cardType: CARD_TYPE_VOICE,
isMe: isMe,
headUrl: headUrl,
voice: MessageVoice(during, path, url));
}
}
class MessageNativePic {
String url;
String nativePath;
Uint8List data;
String recordPath;
MessageNativePic(this.url, this.nativePath, this.data, this.recordPath);
}
class MessageBeauty {
String id;
String url;
String title;
String money;
MessageBeauty(this.id, this.url, this.title, this.money);
}
class MessageMoney {
String url;
MessageMoney(this.url);
}
class MessageVoice {
String during;
String url;
String path;
MessageVoice(this.during, this.path, this.url);
}
class MessageTime {
String time;
MessageTime(this.time);
}
class MessageNormal {
String content;
MessageNormal(this.content);
}
class MessageDiary {
String leftUrl;
String rightUrl;
String userName;
String jumpUrl;
List<String> tags;
MessageDiary(
this.leftUrl, this.rightUrl, this.userName, this.tags, this.jumpUrl);
}
/*
* @author lsy
* @date 2019-10-08
**/
import 'package:shared_preferences/shared_preferences.dart';
import 'MemoryCache.dart';
import 'ShareCache.dart';
const MEMORY_CACHE = "MEMORY_CACHE";
const SHARE_CACHE = "SHARE_CACHE";
SharedPreferences sharedPreferences;
class CacheManager {
MemoryCache memoryCache;
ShareCache shareCache;
static CacheManager _instance = CacheManager._();
CacheManager._() {
memoryCache = new MemoryCache();
shareCache = new ShareCache();
}
static CacheManager getInstance() {
return _instance;
}
ICache get(String whichCache) {
if (whichCache == MEMORY_CACHE) {
return memoryCache;
} else if (whichCache == SHARE_CACHE) {
return shareCache;
}
}
}
class ICache {
dynamic get(String key) {}
void save(String key, dynamic value) {}
void clearAll(){}
}
/*
* @author lsy
* @date 2019-10-08
**/
import 'CacheManager.dart';
class MemoryCache implements ICache {
Map<String, dynamic> _cacheMap = new Map();
@override
get(String key) {
return _cacheMap[key];
}
@override
void save(String key, value) {
_cacheMap[key] = value;
}
@override
void clearAll() {
_cacheMap.clear();
}
}
/*
* @author lsy
* @date 2019-10-08
**/
import 'package:gm_flutter/commonModel/base/BaseUtil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'CacheManager.dart';
class ShareCache implements ICache {
@override
get(String key) {
return sharedPreferences.get(key);
}
@override
void save(String key, value) {
if (value is String) {
sharedPreferences.setString(key, value).whenComplete(() {
if (isDebug) {
print("save String ${value} success");
}
});
} else if (value is bool) {
sharedPreferences.setBool(key, value).whenComplete(() {
if (isDebug) {
print("save bool ${value} success");
}
});
} else if (value is double) {
sharedPreferences.setDouble(key, value).whenComplete(() {
if (isDebug) {
print("save double ${value} success");
}
});
} else if (value is int) {
sharedPreferences.setInt(key, value).whenComplete(() {
if (isDebug) {
print("save int ${value} success");
}
});
} else if (value is List<String>) {
sharedPreferences.setStringList(key, value).whenComplete(() {
if (isDebug) {
print("save StringList ${value} success");
}
});
} else {
if (isDebug) {
throw Exception("save error type");
}
}
}
@override
void clearAll() {
sharedPreferences.clear().whenComplete(() {});
}
}
/*
* @author lsy
* @date 2020/6/15
**/
/*
* @author lsy
* @date 2019-10-24
**/
class LoginEvent {
final String userID;
final String cookie;
LoginEvent(this.userID, this.cookie);
}
/*
* @author lsy
* @date 2019-10-24
**/
class SyncMessageEvent {
SyncMessageEvent();
}
/*
* @author lsy
* @date 2020/6/12
**/
import 'package:flutter/material.dart';
class NavigationService {
final GlobalKey<NavigatorState> navigatorKey =
new GlobalKey<NavigatorState>();
Future<dynamic> navigateTo(String routeName) {
return navigatorKey.currentState.pushNamed(routeName);
}
void goBack() {
return navigatorKey.currentState.pop();
}
}
/*
* @author lsy
* @date 2019-09-16
**/
import 'dart:math';
import 'package:dio/dio.dart';
import 'package:gm_flutter/commonModel/base/BaseUtil.dart';
import 'DioUtil.dart';
/**
* 生产环境
*/
const String APP_HOST_RELEASE = "http://profession.paas-merchant.env";
/**
* 测试环境
*/
//const String APP_HOST_DEBUG = "http://backend.paas-merchant.envs";
//const String APP_HOST_DEBUG = "http://doctor.paas-merchant.env";
const String APP_HOST_DEBUG = "http://profession.paas-merchant.env";
/**
* 开发环境
*/
const String APP_HOST_DEV = "http://profession.paas-merchant.env";
class Api {
static String BUILD_CONFIG;
static String PROVIDER_NAME;
static Api intance = new Api._();
Api._();
static Api getInstance() {
return intance;
}
String getBaseUrl() {
if (!isDebug) {
return APP_HOST_RELEASE;
} else {
return APP_HOST_DEBUG;
}
}
}
/*
* @author lsy
* @date 2020/5/14
**/
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
import 'package:cookie_jar/cookie_jar.dart';
class DioCookieManager {
static DioCookieManager _cookieManager;
DefaultCookieJar cookieJar;
CookieManager cookieManager;
DioCookieManager._() {
cookieJar = new DefaultCookieJar();
cookieManager = new CookieManager(cookieJar);
}
static DioCookieManager getInstance() {
if (_cookieManager == null) {
_cookieManager = new DioCookieManager._();
}
return _cookieManager;
}
CookieManager getCookieManager() {
return cookieManager;
}
void clearCookie() {
cookieJar.deleteAll();
}
}
/*
* @author lsy
* @date 2020/5/14
**/
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:gm_flutter/commonModel/cache/CacheManager.dart';
import 'DioUtil.dart';
class DioInterceptorManager {
static DioInterceptorManager _interceptorManager;
DioInterceptorManager._() {}
static DioInterceptorManager getInstance() {
if (_interceptorManager == null) {
_interceptorManager = new DioInterceptorManager._();
}
return _interceptorManager;
}
InterceptorsWrapper getIntercept() {
return new InterceptorsWrapper(onRequest: (opt) {
if (CacheManager.getInstance().get(SHARE_CACHE).get(NET_COOKIE) != null) {
if (opt.headers == null) {
opt.headers = Map();
}
opt.headers[HttpHeaders.cookieHeader] =
CacheManager.getInstance().get(SHARE_CACHE).get(NET_COOKIE);
}
print("请求之前 onRequest${opt.headers}");
}, onResponse: (response) {
print("响应之前 onResponse${response}");
}, onError: (e) {
print("网络错误 $e message ${e.message}");
});
}
String formatError(DioError e) {
String reason = "";
if (e.type == DioErrorType.CONNECT_TIMEOUT) {
// It occurs when url is opened timeout.
reason = "连接超时 ${e.message}";
} else if (e.type == DioErrorType.SEND_TIMEOUT) {
// It occurs when url is sent timeout.
reason = "请求超时 ${e.message}";
} else if (e.type == DioErrorType.RECEIVE_TIMEOUT) {
//It occurs when receiving timeout
reason = "响应超时 ${e.message}";
} else if (e.type == DioErrorType.RESPONSE) {
// When the server response, but with a incorrect status, such as 404, 503...
reason = "出现异常 ${e.message}";
} else if (e.type == DioErrorType.CANCEL) {
// When the request is cancelled, dio will throw a error with this type.
reason = "请求取消 ${e.message}";
} else {
//DEFAULT Default error type, Some other Error. In this case, you can read the DioError.error if it is not null.
reason = "未知错误 ${e.message}";
}
return reason;
}
}
import 'dart:convert';
import 'dart:io';
import 'package:dio/adapter.dart';
import 'package:dio/dio.dart';
import 'package:gm_flutter/commonModel/base/BaseUtil.dart';
import 'Api.dart';
import 'DioCookieManager.dart';
import 'DioInterceptor.dart';
const NET_COOKIE = "NET_COOKIE";
class DioUtil {
static final DioUtil _instance = DioUtil._init();
static Dio _dio;
static BaseOptions _options = getDefOptions();
static Map<String, dynamic> addHeadMap;
/// 是否是debug模式.
static bool _isDebug = isDebug;
static DioUtil getInstance() {
return _instance;
}
factory DioUtil() {
return _instance;
}
static var interceptor = InterceptorsWrapper();
DioUtil._init() {
_dio = new Dio(_options);
_dio.interceptors.add(DioInterceptorManager.getInstance().getIntercept());
_dio.interceptors.add(DioCookieManager.getInstance().getCookieManager());
}
void clearCookie() {
DioCookieManager.getInstance().clearCookie();
}
void setProxy(String proxy) {
_dio = new Dio(_options);
_dio.interceptors.add(DioInterceptorManager.getInstance().getIntercept());
_dio.interceptors.add(DioCookieManager.getInstance().getCookieManager());
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
client.findProxy = (url) {
return 'PROXY $proxy:8888';
};
};
}
Dio getDio() {
return _dio;
}
static BaseOptions getDefOptions() {
BaseOptions options = BaseOptions();
options.connectTimeout = 10 * 1000;
options.receiveTimeout = 20 * 1000;
options.responseType = ResponseType.plain;
Map<String, dynamic> headers = Map<String, dynamic>();
headers['Accept'] = 'application/json';
headers['version'] = '1.0.0';
options.headers = headers;
options.baseUrl = Api.getInstance().getBaseUrl() + "/";
return options;
}
}
/*
* @author lsy
* @date 2019-09-05
**/
import 'package:flutter_common/Annotations/anno/ServerEntity.dart';
@ServerEntity()
class SimpleResponce {
int error;
String message;
Null extra;
Data data;
SimpleResponce({this.error, this.message, this.extra, this.data});
SimpleResponce.fromJson(Map<String, dynamic> json) {
error = json['error'];
message = json['message'];
extra = json['extra'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['message'] = this.message;
data['extra'] = this.extra;
if (this.data != null) {
data['data'] = this.data.toJson();
}
return data;
}
}
class Data {
int error;
String message;
Data({this.error, this.message});
Data.fromJson(Map<String, dynamic> json) {
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
/*
* @author lsy
* @date 2019-10-18
**/
import 'package:flutter/material.dart';
class DialogRouter extends PageRouteBuilder {
final Widget page;
DialogRouter(this.page)
: super(
opaque: false,
pageBuilder: (context, animation, secondaryAnimation) => page,
transitionsBuilder:
(context, animation, secondaryAnimation, child) {
return child;
});
}
/*
* @author lsy
* @date 2020/5/20
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_common/commonModel/picker/base/BaseCenterPicker.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
class TwoTextPicker implements ICenterPicker {
final String title;
final String content1;
final String content2;
VoidCallback dismissCall;
TwoTextPicker(this.title, this.content1, this.content2);
@override
Widget build(BuildContext context, int alp) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Color.fromARGB(alp, 255, 255, 255),
),
width: 285,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 16),
child: Text(
title,
textScaleFactor: 1.0,
style: TextStyle(
decoration: TextDecoration.none,
fontSize: 16,
color: Color.fromARGB(alp, 40, 40, 40),
fontStyle: FontStyle.normal,
fontWeight: FontWeight.w600),
),
),
Container(
margin: EdgeInsets.only(top: 18),
child: baseText(content1, 14, Color.fromARGB(alp, 102, 102, 102)),
),
Container(
margin: EdgeInsets.only(top: 12),
child: baseText(content2, 14, Color.fromARGB(alp, 102, 102, 102)),
),
Container(
height: 18,
),
baseDivide(0),
InkWell(
onTap: () {
dismissCall();
},
child: Container(
width: double.maxFinite,
height: 48,
alignment: Alignment.center,
child: baseText("确定", 16, Color.fromARGB(alp, 32, 189, 187)),
),
)
],
),
);
}
@override
void dispose() {}
@override
void initState(dismissCall, BuildContext context) {
this.dismissCall = dismissCall;
}
}
/*
* @author lsy
* @date 2019-10-18
**/
import 'package:flutter/material.dart';
import 'package:flutter_common/commonModel/view/iOSLoading.dart';
import 'base/DialogRouter.dart';
Future popLoadingDialogText(BuildContext context, bool canceledOnTouchOutside,
String text, ChangeNotifier dismiss) {
return Navigator.push(context,
DialogRouter(LoadingDialog(canceledOnTouchOutside, text, dismiss)));
}
class LoadingDialog extends StatefulWidget {
LoadingDialog(this.canceledOnTouchOutside, this.text, this.dismiss) : super();
///点击背景是否能够退出
final bool canceledOnTouchOutside;
final String text;
final ChangeNotifier dismiss;
@override
State<StatefulWidget> createState() => LoadingDialogState();
}
class LoadingDialogState extends State<LoadingDialog> {
@override
void initState() {
super.initState();
widget.dismiss.addListener(() {
if (widget.dismiss != null) {
Navigator.pop(context);
widget.dismiss.dispose();
}
});
}
@override
Widget build(BuildContext context) {
return Center(
child: new Material(
///背景透明
color: Colors.transparent,
///保证控件居中效果
child: Stack(
children: <Widget>[
GestureDetector(
///点击事件
onTap: () {
if (widget.canceledOnTouchOutside) {
Navigator.pop(context);
}
},
),
_dialog()
],
)),
);
}
Widget _dialog() {
return new Center(
///弹框大小
child: new Container(
width: 120.0,
height: 120.0,
child: new Container(
///弹框背景和圆角
decoration: ShapeDecoration(
color: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(8.0),
),
),
),
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new MyCupertinoActivityIndicator(
backColor: Colors.white,
),
new Padding(
padding: const EdgeInsets.only(
top: 20.0,
),
child: new Text(
widget.text,
style: new TextStyle(fontSize: 16.0, color: Colors.white),
),
),
],
),
),
),
);
}
}
/*
* @author lsy
* @date 2020/5/19
**/
import 'package:flutter/material.dart';
class BaseMenuListener extends ChangeNotifier {
bool isShow = false;
void show() {
isShow = true;
notifyListeners();
}
void hide() {
isShow = false;
notifyListeners();
}
void reverse() {
isShow = !isShow;
notifyListeners();
}
}
/*
* @author lsy
* @date 2020/5/19
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter_common/commonModel/live/LiveData.dart';
import 'BaseMenuListener.dart';
class BasePopMenu extends StatefulWidget {
final double leftPos;
final double topPos;
final double width;
final double height;
final int maxHeight;
final Widget child;
final BaseMenuListener listener;
BasePopMenu(
{this.leftPos,
this.topPos,
this.maxHeight,
this.width,
this.height,
this.child,
this.listener});
@override
State<StatefulWidget> createState() {
return BasePopMenuState();;
}
}
class BasePopMenuState extends State<BasePopMenu>
with TickerProviderStateMixin {
Animation<double> animation;
AnimationController animationController;
LiveData<double> _liveData = LiveData();
bool isOpen = false;
@override
void initState() {
super.initState();
animationController = new AnimationController(
duration: const Duration(milliseconds: 300), vsync: this)
..addListener(() {
_liveData.notifyView(animation.value * widget.maxHeight);
});
animation = new Tween(begin: 0.0, end: 1.0).animate(animationController);
widget.listener.addListener(() {
if(widget.listener.isShow){
animationController.forward();
}else{
animationController.reverse();
}
});
}
@override
Widget build(BuildContext context) {
return Positioned(
left: widget.leftPos,
top: widget.topPos,
width: widget.width,
height: widget.height,
child: StreamBuilder(
stream: _liveData.stream,
initialData: 0.0,
builder: (c, data) {
return Container(
height: data.data,
child: widget.child,
);
},
));
}
@override
void dispose() {
_liveData.dispost();
animationController.dispose();
super.dispose();
}
}
/*
* @author lsy
* @date 2020/5/22
**/
import 'dart:async';
class RxDispose {
List<StreamSubscription> rx;
RxDispose() {
rx = List();
}
void addDispose(StreamSubscription streamSubscription) {
rx.add(streamSubscription);
}
void dispose() {
rx.forEach((element) {
element.cancel();
});
}
}
extension StreamSubscriptionExt on StreamSubscription {
StreamSubscription addToDispose(RxDispose rxDispose) {
rxDispose.addDispose(this);
return this;
}
}
/*
* @author lsy
* @date 2020/6/4
**/
class SingleNotify {
static SingleNotify _notify;
static SingleNotify instance() {
if (_notify == null) {
_notify = SingleNotify._();
}
return _notify;
}
SingleNotify._() {}
}
/*
* @author lsy
* @date 2020/5/22
**/
import 'package:flutter/material.dart';
import 'package:gm_flutter/commonModel/view/ActivePage.dart';
class DartUtil {
//为了导包
}
extension WidgetExt on Widget {
Widget margin(EdgeInsets edgeInsets, double width, double height) {
return Container(
width: width,
height: height,
margin: edgeInsets,
child: this,
);
}
Widget padding(EdgeInsets edgeInsets, double width, double height) {
return Container(
width: width,
height: height,
padding: edgeInsets,
child: this,
);
}
Widget gestureDetector(VoidCallback onTap) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: onTap,
child: this,
);
}
Widget minColumn(List<Widget> list) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: list,
);
}
Widget toActive() {
return ActivePage(this);
}
}
extension StringExt on String {
bool isPhone() {
return new RegExp(
'^((13[0-9])|(15[^4])|(166)|(17[0-8])|(18[0-9])|(19[8-9])|(147,145))\\d{8}\$')
.hasMatch(this);
}
}
/*
* @author lsy
* @date 2019-10-21
**/
import 'dart:isolate';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
class IsolateUtil {
static ReceivePort receivePort = ReceivePort();
static Future<T> paseJsonByIsolate<T>(Function function) async {
// 通过spawn新建一个isolate,并绑定静态方法
await Isolate.spawn(dataLoader, receivePort.sendPort);
// 获取新isolate的监听port
SendPort sendPort = await receivePort.first;
// 调用sendReceive自定义方法
return await sendReceive(sendPort, function);
}
// isolate的绑定方法
static dataLoader(SendPort sendPort) async {
// 创建监听port,并将sendPort传给外界用来调用
ReceivePort receivePort = ReceivePort();
sendPort.send(receivePort.sendPort);
// 监听外界调用
await for (var msg in receivePort) {
SendPort callbackPort = msg[0];
Function function = msg[1];
callbackPort.send(function());
}
}
// 创建自己的监听port,并且向新isolate发送消息
static Future sendReceive(SendPort sendPort, Function function) {
ReceivePort receivePort = ReceivePort();
sendPort.send([receivePort.sendPort, function]);
// 接收到返回值,返回给调用者
return receivePort.first;
}
}
/*
* @author lsy
* @date 2020/5/29
**/
import 'dart:convert';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart';
const MD5KEY="aYMX5Wk7Cu";
class MD5Util {
static String generateMd5(String data) {
var content = new Utf8Encoder().convert(data);
var digest = md5.convert(content);
// 这里其实就是 digest.toString()
return hex.encode(digest.bytes);
}
}
/*
* @author lsy
* @date 2020/6/1
**/
class NumberUtil {
static String formatNum(double num, int postion) {
if ((num.toString().length - num.toString().lastIndexOf(".") - 1) <
postion) {
//小数点后有几位小数
return num.toStringAsFixed(postion)
.substring(0, num.toString().lastIndexOf(".") + postion + 1)
.toString();
} else {
return num.toString()
.substring(0, num.toString().lastIndexOf(".") + postion + 1)
.toString();
}
}
}
/*
* @author lsy
* @date 2020/5/22
**/
import 'package:flutter_common/commonModel/toast/NativeToast.dart';
import 'package:flutter_common/commonModel/toast/toast.dart';
class PrintUtil {
static void printBug(err) {
print(err.toString());
NativeToast.showNativeToast("网络错误");
}
}
/*
* @author lsy
* @date 2020/5/14
**/
import 'package:flutter/material.dart';
class WidgetUtil {
static RelativeRect buttonMenuPosition(BuildContext c) {
final RenderBox bar = c.findRenderObject();
final RenderBox overlay = Overlay.of(c).context.findRenderObject();
final RelativeRect position = RelativeRect.fromRect(
Rect.fromPoints(
bar.localToGlobal(bar.size.bottomRight(Offset.zero), ancestor: overlay),
bar.localToGlobal(bar.size.bottomRight(Offset.zero), ancestor: overlay),
),
Offset.zero & overlay.size,
);
return position;
}
static RelativeRect buttonLeftMenuPosition(BuildContext c) {
final RenderBox bar = c.findRenderObject();
final RenderBox overlay = Overlay.of(c).context.findRenderObject();
final RelativeRect position = RelativeRect.fromRect(
Rect.fromPoints(
bar.localToGlobal(bar.size.bottomLeft(Offset.zero), ancestor: overlay),
bar.localToGlobal(bar.size.bottomLeft(Offset.zero), ancestor: overlay),
),
Offset.zero & overlay.size,
);
return position;
}
}
/*
* @author lsy
* @date 2020/6/4
**/
import 'package:flutter/cupertino.dart';
class ActivePage extends StatefulWidget {
Widget child;
ActivePage(this.child);
@override
State<StatefulWidget> createState() {
return ActiveState();
}
}
class ActiveState extends State<ActivePage> with AutomaticKeepAliveClientMixin {
@override
bool get wantKeepAlive => true;
@override
Widget build(BuildContext context) {
return widget.child;
}
}
/*
* @author lsy
* @date 2020/5/20
**/
import 'package:flutter/cupertino.dart';
import 'DarkToastView.dart';
class DarkToastManager {
static OverlayEntry showDartToast(
BuildContext context, Widget left, String right) {
OverlayEntry overlayEntry = OverlayEntry(builder: (c) {
return DartToastView(
leftChild: left,
rightText: right,
);
});
Overlay.of(context).insert(overlayEntry);
return overlayEntry;
}
}
/*
* @author lsy
* @date 2020/5/20
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
class DartToastView extends StatelessWidget {
final Widget leftChild;
final String rightText;
DartToastView({this.leftChild, this.rightText});
@override
Widget build(BuildContext context) {
return Container(
height: 43,
alignment: Alignment.center,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: Color(0xcc1D2530)),
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 19, top: 13.5, bottom: 13.5),
width: 16,
height: 16,
child: leftChild,
),
Container(
width: 8,
height: 1,
),
baseText(rightText, 13, Colors.white),
Container(
width: 19,
height: 1,
)
],
)),
);
}
}
/*
* @author lsy
* @date 2020/5/20
**/
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_svg/flutter_svg.dart';
const Duration _kExpand = Duration(milliseconds: 200);
class ExpansionLayout extends StatefulWidget {
const ExpansionLayout({
Key key,
this.leading,
@required this.title,
this.subtitle,
this.backgroundColor,
this.onExpansionChanged,
this.children = const <Widget>[],
this.trailing,
this.initiallyExpanded = false,
}) : assert(initiallyExpanded != null),
super(key: key);
final Widget leading;
final Widget title;
final Widget subtitle;
final ValueChanged<bool> onExpansionChanged;
final List<Widget> children;
final Color backgroundColor;
final Widget trailing;
final bool initiallyExpanded;
@override
_ExpansionTileState createState() => _ExpansionTileState();
}
class _ExpansionTileState extends State<ExpansionLayout>
with SingleTickerProviderStateMixin {
static final Animatable<double> _easeOutTween =
CurveTween(curve: Curves.easeOut);
static final Animatable<double> _easeInTween =
CurveTween(curve: Curves.easeIn);
static final Animatable<double> _halfTween =
Tween<double>(begin: 0.0, end: 0.5);
final ColorTween _borderColorTween = ColorTween();
final ColorTween _headerColorTween = ColorTween();
final ColorTween _backgroundColorTween = ColorTween();
AnimationController _controller;
Animation<double> _iconTurns;
Animation<double> _heightFactor;
Animation<Color> _borderColor;
Animation<Color> _headerColor;
Animation<Color> _backgroundColor;
bool _isExpanded = false;
@override
void initState() {
super.initState();
_controller = AnimationController(duration: _kExpand, vsync: this);
_heightFactor = _controller.drive(_easeInTween);
_iconTurns = _controller.drive(_halfTween.chain(_easeInTween));
_borderColor = _controller.drive(_borderColorTween.chain(_easeOutTween));
_headerColor = _controller.drive(_headerColorTween.chain(_easeInTween));
_backgroundColor =
_controller.drive(_backgroundColorTween.chain(_easeOutTween));
_isExpanded = PageStorage.of(context)?.readState(context) as bool ??
widget.initiallyExpanded;
if (_isExpanded) _controller.value = 1.0;
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
void _handleTap() {
setState(() {
_isExpanded = !_isExpanded;
if (_isExpanded) {
_controller.forward();
} else {
_controller.reverse().then<void>((void value) {
if (!mounted) return;
setState(() {
// Rebuild without widget.children.
});
});
}
PageStorage.of(context)?.writeState(context, _isExpanded);
});
if (widget.onExpansionChanged != null)
widget.onExpansionChanged(_isExpanded);
}
Widget _buildChildren(BuildContext context, Widget child) {
final Color borderSideColor = _borderColor.value?? Color(0xffe5e5e5);
return Container(
decoration: BoxDecoration(
// color: _backgroundColor.value ?? Colors.transparent,
border: Border(
bottom: BorderSide(color: borderSideColor),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTileTheme.merge(
contentPadding: EdgeInsets.only(),
textColor: _headerColor.value,
child: ListTile(
onTap: _handleTap,
leading: widget.leading,
title: widget.title,
subtitle: widget.subtitle,
trailing: widget.trailing ??
RotationTransition(
turns: _iconTurns,
child: Container(
width: 15,
height: 16,
child: SvgPicture.asset("images/bottom_arrow_black.svg"),
),
),
),
),
ClipRect(
child: Align(
heightFactor: _heightFactor.value,
child: child,
),
),
],
),
);
}
@override
void didChangeDependencies() {
final ThemeData theme = Theme.of(context);
_borderColorTween.begin=Color(0xffe5e5e5);
_borderColorTween.end = Colors.transparent;
_headerColorTween
..begin = theme.textTheme.subtitle1.color
..end = theme.accentColor;
_backgroundColorTween.end = widget.backgroundColor;
super.didChangeDependencies();
}
@override
Widget build(BuildContext context) {
final bool closed = !_isExpanded && _controller.isDismissed;
return AnimatedBuilder(
animation: _controller.view,
builder: _buildChildren,
child: closed ? null : Column(children: widget.children),
);
}
}
/*
* @author lsy
* @date 2020/5/28
**/
import 'package:flutter/material.dart';
class ImagesAnimation extends StatefulWidget {
final double w;
final double h;
final ImagesAnimationEntry entry;
final int durationSeconds;
ImagesAnimation(
{Key key, this.w: 80, this.h: 80, this.entry, this.durationSeconds: 3000})
: super(key: key);
@override
_InState createState() {
return _InState();
}
}
class _InState extends State<ImagesAnimation> with TickerProviderStateMixin {
AnimationController _controller;
Animation<int> _animation;
@override
void initState() {
super.initState();
_controller = new AnimationController(
vsync: this, duration: Duration(milliseconds: widget.durationSeconds))
..repeat();
_animation =
new IntTween(begin: widget.entry.lowIndex, end: widget.entry.highIndex)
.animate(_controller);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return new AnimatedBuilder(
animation: _animation,
builder: (BuildContext context, Widget child) {
String frame = _animation.value.toString();
if (frame.length == 1) {
frame = "0" + frame;
}
return new Image.asset(
"${widget.entry.basePath}${frame}.png",
gaplessPlayback: true, //避免图片闪烁
width: widget.w,
height: widget.h,
);
},
);
}
}
class ImagesAnimationEntry {
int lowIndex = 0;
int highIndex = 0;
String basePath;
ImagesAnimationEntry(this.lowIndex, this.highIndex, this.basePath);
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_boost/flutter_boost.dart';
import 'package:flutter_common/Annotations/anno/RouterCenter.dart';
import 'package:flutter_common/commonModel/util/WindowUtil.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'DemoPage.dart';
import 'commonModel/base/BaseUtil.dart';
import 'commonModel/nav/NavigationService.dart';
NavigationService navigationService;
void main() {
navigationService = NavigationService();
WidgetsFlutterBinding.ensureInitialized();
FlutterError.onError = (FlutterErrorDetails details) async {
if (isDebug) {
FlutterError.dumpErrorToConsole(details);
Zone.root.handleUncaughtError(details.exception, details.stack);
Zone.current.handleUncaughtError(details.exception, details.stack);
} else {
Zone.current.handleUncaughtError(details.exception, details.stack);
}
};
runZonedGuarded(() {
WidgetsFlutterBinding.ensureInitialized();
runApp(
MyAppWidget(),
);
}, (Object error, StackTrace stack) {
//TODO
print("lsy EEEEEE ${error.toString()} ${stack.toString()}");
});
}
@RouterCenter()
class MyAppWidget extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return MyApp();
}
}
class MyApp extends State<MyAppWidget> {
@override
void initState() {
super.initState();
FlutterBoost.singleton.registerPageBuilders({
'demoPage': (pageName, params, _) {
return DemoPage();
},
});
// FlutterBoost.singleton.addBoostContainerLifeCycleObserver((state, settings) {
// });
// FlutterBoost.singleton.addBoostNavigatorObserver(TestBoostNavigatorObserver());
}
@override
Widget build(BuildContext context) {
WindowUtil.setBarStatus(true);
return MaterialApp(
theme: ThemeData(),
builder: FlutterBoost.init(postPush: _onRoutePushed),
home: isDebug
? Container(
color: Colors.red,
)
: Container(
color: Colors.white,
child: Center(
child: loadingItem(),
),
));
}
void _onRoutePushed(
String pageName,
String uniqueId,
Map<String, dynamic> params,
Route<dynamic> route,
Future<dynamic> _,
) {}
}
// GENERATED CODE - DO NOT MODIFY BY HAND
// **************************************************************************
// RouterCenterGenerator
// **************************************************************************
//ClueRouterImpl is resign : true
import "package:gm_flutter/ClueModel/ClueRouterImpl.dart";
import "package:gm_flutter/ClueModel/ClueRouter.dart";
import "package:flutter_common/Annotations/RouterBaser.dart";
class RouterCenterImpl {
Map<String, RouterBaser> map;
factory RouterCenterImpl() => _sharedInstance();
static RouterCenterImpl _instance;
RouterCenterImpl._() {
if (map == null) {
map = new Map();
init();
} else {
throw Exception("too many RouterCenter instance!!! fix it ");
}
}
static RouterCenterImpl _sharedInstance() {
if (_instance == null) {
_instance = RouterCenterImpl._();
}
return _instance;
}
void init() {
map.putIfAbsent("ClueRouter", () => ClueRouterImpl());
}
RouterBaser getModel(String modelName) {
return map[modelName];
}
ClueRouter findClueRouter() {
if (map["ClueRouter"] == null) {
return null;
}
return map["ClueRouter"] as ClueRouter;
}
}
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.39.10"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
build:
dependency: transitive
description:
name: build
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.2"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.9"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.2.0"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.3.2"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.flutter-io.cn"
source: hosted
version: "7.1.0"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0+1"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.3"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.3.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.14.12"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
cookie_jar:
dependency: transitive
description:
name: cookie_jar
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.6"
dio:
dependency: "direct main"
description:
name: dio
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.9"
dio_cookie_manager:
dependency: "direct main"
description:
name: dio_cookie_manager
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
event_bus:
dependency: transitive
description:
name: event_bus
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
file:
dependency: transitive
description:
name: file
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.2.0"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.10.11"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_boost:
dependency: "direct main"
description:
path: "."
ref: "v1.17.1-hotfixes"
resolved-ref: d6e1c9192ed9347ba61e32a8af9afb6ae2fe4b74
url: "https://github.com/alibaba/flutter_boost.git"
source: git
version: "1.12.13+2"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.1"
flutter_common:
dependency: "direct main"
description:
path: "."
ref: de509ebaf4724de7c70d05ea403dbe13ecc775ea
resolved-ref: de509ebaf4724de7c70d05ea403dbe13ecc775ea
url: "https://github.com/asd451398533/flutter_common.git"
source: git
version: "0.0.1"
flutter_svg:
dependency: transitive
description:
name: flutter_svg
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.17.4"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
fluttertoast:
dependency: transitive
description:
name: fluttertoast
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.1"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.14.0+3"
http:
dependency: transitive
description:
name: http
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.1"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.12"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
io:
dependency: transitive
description:
name: io
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.4"
js:
dependency: transitive
description:
name: js
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.2"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.1"
logger:
dependency: transitive
description:
name: logger
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.11.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.8"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.6+3"
node_interop:
dependency: transitive
description:
name: node_interop
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
node_io:
dependency: transitive
description:
name: node_io
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.3"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.4"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.4"
path_provider:
dependency: "direct main"
description:
name: path_provider
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.11"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+1"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4+3"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.0"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.0.1"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.1"
platform_detect:
dependency: transitive
description:
name: platform_detect
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.0"
process:
dependency: transitive
description:
name: process
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.13"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.4"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.5"
pull_to_refresh:
dependency: "direct main"
description:
name: pull_to_refresh
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.8"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
rxdart:
dependency: "direct main"
description:
name: rxdart
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.24.1"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.5.7+3"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+10"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.2+7"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.7"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.3"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_gen:
dependency: "direct dev"
description:
name: source_gen
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.5"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.0"
sqflite:
dependency: transitive
description:
name: sqflite
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2+1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.5"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0+1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.15"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.1+2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
url_launcher:
dependency: transitive
description:
name: url_launcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.4.11"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+7"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.7"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.1+6"
uuid:
dependency: transitive
description:
name: uuid
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.8"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.7+15"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.6.1"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.8.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
name: gm_flutter
description: A new flutter module project.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# cupertino_icons: ^0.1.3
cached_network_image: ^2.2.0+1
flutter_boost:
git:
url: 'https://github.com/alibaba/flutter_boost.git'
ref: 'v1.17.1-hotfixes'
flutter_common:
git:
url: 'https://github.com/asd451398533/flutter_common.git'
ref: 'de509ebaf4724de7c70d05ea403dbe13ecc775ea'
#网络库
dio: ^3.0.0
dio_cookie_manager: ^1.0.0
#Rx编程
rxdart: ^0.24.0
#上拉下拉
pull_to_refresh: ^1.5.8
#获取文件夹/沙盒路径
path_provider: ^1.6.7
#权限
permission_handler: ^5.0.0
#轻量级存储
shared_preferences: ^0.5.7+1
dev_dependencies:
flutter_test:
sdk: flutter
source_gen: '>=0.8.0'
build_runner: ^1.9.0
flutter:
uses-material-design: true
module:
androidX: true
androidPackage: com.example.gm_flutter
iosBundleIdentifier: com.example.gmFlutter
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:gm_flutter/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyAppWidget());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
#!/usr/bin/env bash
echo START
projectDir=`pwd`
rootFlutter=`which flutter`
rootDir=${rootFlutter%/*}
dif=debug
#dif=release
message=增加他人的专家页面
#====clean
cd ${projectDir}
${rootFlutter} clean
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
${rootFlutter} packages get
#cd ${projectDir}/android
#./gradlew assembleRelease
rm -rf ${projectDir}/build
flutter build apk --release --target-platform android-arm
#rm -rf /Users/apple/lsy/aar_update/
#mkdir /Users/apple/lsy/aar_update/
#rm -rf /Users/apple/lsy/update/
#mkdir /Users/apple/lsy/update/
#mkdir /Users/apple/lsy/update/android${message}${dif}/
#mkdir /Users/apple/lsy/update/ios${message}${dif}/
#cp -r /Users/apple/lsy/gm_flutter/build/app/outputs/aar/app-release.aar /Users/apple/lsy/aar_update/app.zip
#cd /Users/apple/lsy/aar_update/
cp -r /Users/apple/lsy/gm_flutter/build/host/outputs/apk/release/app-release.apk /Users/apple/lsy/gm_flutter/build/host/outputs/apk/release/app-release.zip
unzip ${projectDir}/build/host/outputs/apk/release/app-release.zip -d ${projectDir}/build/host/outputs/apk/release
#cp -r /Users/apple/lsy/gm_flutter/build/host/outputs/apk/release/app-release/lib/armeabi-v7a/* /Users/apple/lsy/update/androd${message}${dif}/
rm -rf /Users/apple/Downloads/PLLL/app/libs/armeabi-v7a/*
cp -r /Users/apple/lsy/gm_flutter/build/host/outputs/apk/release/lib/armeabi-v7a/* /Users/apple/Downloads/PLLL/app/libs/armeabi-v7a/
#cd ${projectDir}
#flutter build ios --release --no-codesign
#cp -r /Users/apple/lsy/gmalpha_flutter/ios/Flutter/App.framework /Users/apple/lsy/update/ios${message}${dif}/
#cp -r /Users/apple/lsy/gmalpha_flutter/ios/Flutter/Flutter.framework /Users/apple/lsy/update/ios${message}${dif}/
#cd /Users/apple/lsy/update/
#open .
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment