张萌 4 years ago
commit 7ee0ed656d

@ -1,3 +1,3 @@
{
"flutterSdkVersion": "2.0.0"
"flutterSdkVersion": "stable"
}

1
.gitattributes vendored

@ -0,0 +1 @@
*.arb diff

@ -0,0 +1,4 @@
arb-dir: lib/l10n
template-arb-file: app_zh.arb
output-localization-file: app_localizations.dart
output-class: S

@ -9,6 +9,7 @@ class API {
static String get resource => '$host/static';
static String image(String path) => '$resource$path';
static String file(String path) => '$resource$path';
static const int networkTimeOut = 10000;
static _Login login = _Login();

@ -1,3 +1,3 @@
class AppValues {
static const String plotName = '人才公寓智慧小区';
}
// class AppValues {
// static const String plotName = '人才公寓智慧小区';
// }

@ -0,0 +1,10 @@
{
"appName": "智慧社区",
"@appName":{
"description": "应用名称"
},
"tempPlotName": "人才公寓智慧小区",
"@tempPlotName":{
"description": "临时使用的小区名称"
}
}

@ -17,6 +17,7 @@ import 'package:akuCommunity/provider/cart.dart';
import 'package:akuCommunity/provider/sign_up_provider.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/developer_util.dart';
import 'package:akuCommunity/utils/headers.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
@ -87,17 +88,18 @@ class _MyAppState extends State<MyApp> {
designSize: Size(750, 1334),
allowFontScaling: true,
builder: () => GetMaterialApp(
title: '智慧社区',
onGenerateTitle: (context) => S.of(context).appName,
debugShowCheckedModeBanner: false,
theme: AppTheme.theme,
home: SplashPage(),
//
localizationsDelegates: [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [const Locale('zh', 'CH')],
supportedLocales: [const Locale('zh')],
locale: Locale('zh'),
builder: BotToastInit(),
navigatorObservers: [BotToastNavigatorObserver()],

@ -15,6 +15,12 @@ class ImgModel {
sort = json['sort'];
}
static String first(List<ImgModel> models) {
if (models == null) return '';
if (models.isEmpty) return '';
return models.first.url ?? '';
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;

@ -9,6 +9,12 @@ class VotingDetailModel {
List<ImgModel> imgUrls;
List<AppVoteCandidateVos> appVoteCandidateVos;
String get firstImage {
if (imgUrls == null) return '';
if (imgUrls.isEmpty) return '';
return imgUrls.first.url ?? '';
}
VotingDetailModel(
{this.id,
this.title,

@ -5,6 +5,8 @@ class HouseModel {
int id;
String roomName;
int estateId;
///1.3.4.
int status;
@ -87,6 +89,7 @@ class HouseModel {
this.type,
this.effectiveTimeStart,
this.effectiveTimeEnd,
this.estateId,
});
HouseModel.fromJson(Map<String, dynamic> json) {
@ -96,6 +99,7 @@ class HouseModel {
type = json['type'];
effectiveTimeStart = json['effectiveTimeStart'];
effectiveTimeEnd = json['effectiveTimeEnd'];
estateId = json['estateId'];
}
Map<String, dynamic> toJson() {

@ -59,9 +59,11 @@ class _EventVotingPageState extends State<EventVotingPage> {
width: double.infinity,
child: ClipRect(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_LOGO_PNG,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(
model.imgUrls.isNotEmpty ? model.imgUrls.first.url : '')),
model.imgUrls.isNotEmpty ? model.imgUrls.first.url : ''),
fit: BoxFit.cover,
),
),
),
Padding(

@ -1,3 +1,4 @@
import 'package:akuCommunity/model/common/img_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -122,8 +123,12 @@ class _VotingDetailPageState extends State<VotingDetailPage> {
child: ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_LOGO_PNG,
image: API.image(model.imgUrls.first.url)),
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(
ImgModel.first(model.imgUrls),
),
fit: BoxFit.cover,
),
),
),
30.w.widthBox,
@ -213,14 +218,11 @@ class _VotingDetailPageState extends State<VotingDetailPage> {
children: [
_model.title.text.black.size(32.sp).bold.maxLines(2).make(),
44.w.heightBox,
SizedBox(
width: double.infinity,
height: 228.w,
child: ClipRRect(
ClipRRect(
borderRadius: BorderRadius.circular(8.w),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_LOGO_PNG,
image: API.image(_model.imgUrls.first.url)),
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(_model.firstImage),
),
),
44.w.heightBox,
@ -257,9 +259,9 @@ class _VotingDetailPageState extends State<VotingDetailPage> {
BotToast.showText(text: '请先选择候选人!');
} else {
BaseModel baseModel =
await ManagerFunc.vote(_selectId, widget.id);
await ManagerFunc.vote(widget.id, _selectId);
if (baseModel.status) {
Get.dialog(_shouwVoteDialog());
await Get.dialog(_shouwVoteDialog());
_hasVoted = true;
setState(() {});
} else {

@ -1,13 +1,12 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/model/manager/article_QR_code_model.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
@ -25,7 +24,7 @@ class DetoCodePage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
AppValues.plotName,
S.of(Get.context).tempPlotName,
style: TextStyle(fontSize: 40.sp, color: Color(0xffffffff)),
),
SizedBox(height: 10.w),

@ -109,7 +109,7 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 32.sp,

@ -1,4 +1,5 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -40,7 +41,7 @@ class _AnimateAppBarState extends State<AnimateAppBar> {
Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context);
return AppBar(
title: Text(AppValues.plotName),
title: Text( S.of(context).tempPlotName),
backgroundColor: _bgColor,
leading: Container(
margin: EdgeInsets.only(left: 32.w),

@ -70,6 +70,7 @@ class _LifePayPageState extends State<LifePayPage> {
GestureDetector(
onTap: () {
Get.to(() => PickMyHousePage());
_controller.callRefresh();
},
child: Row(
children: [
@ -83,7 +84,14 @@ class _LifePayPageState extends State<LifePayPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppValues.plotName.text.black.size(32.sp).bold.make(),
S
.of(context)
.tempPlotName
.text
.black
.size(32.sp)
.bold
.make(),
10.w.heightBox,
appProvider.selectedHouse.roomName.text.black
.size(32.sp)
@ -210,6 +218,7 @@ class _LifePayPageState extends State<LifePayPage> {
@override
Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context);
final appProvider = Provider.of<AppProvider>(context);
return BeeScaffold(
title: '生活缴费',
actions: [
@ -227,9 +236,7 @@ class _LifePayPageState extends State<LifePayPage> {
body: BeeListView(
path: API.manager.dailyPaymentList,
controller: _controller,
extraParams: {
'estateId': userProvider.currentHouseId,
},
extraParams: {'estateId': appProvider.selectedHouse.estateId},
convert: (model) {
_selectPay = List.generate(model.tableList.length,
(index) => SelectPay(payCount: 0, payTotal: 0.0));

@ -1,4 +1,5 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -103,6 +104,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
Widget _buildCard(DailyPaymentTypeVos model) {
UserProvider userProvider = Provider.of<UserProvider>(context);
final appProvider = Provider.of<AppProvider>(context);
return Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
child: Column(
@ -111,7 +113,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
children: [
model.name.text.black.size(30.sp).bold.make(),
Spacer(),
'${AppValues.plotName} ${userProvider.currentHouse}'
'${S.of(context).tempPlotName} ${appProvider.selectedHouse.estateId}'
.text
.color(ktextSubColor)
.size(24.sp)

@ -1,4 +1,3 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:flutter/material.dart';
@ -72,14 +71,13 @@ class _MyHousePageState extends State<MyHousePage> {
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: GestureDetector(
onTap: () {
userProvider.setCurrentHouse(estateName);
setState(() {});
},
child: Row(
children: [
CommonRadio(
value: BeeParse.getEstateNameId(estateName),
groupValue: userProvider.currentHouseId,
groupValue: 0,
size: 32.w,
),
24.w.widthBox,
@ -87,7 +85,10 @@ class _MyHousePageState extends State<MyHousePage> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
AppValues.plotName.text
S
.of(context)
.tempPlotName
.text
.size(24.sp)
.color(ktextSubColor)
.bold
@ -122,8 +123,8 @@ class _MyHousePageState extends State<MyHousePage> {
...userProvider.userDetailModel.estateNames.isEmpty
? [SizedBox()]
: userProvider.userDetailModel.estateNames
.map((e) => _buildCard(userProvider.currentHouseId, e,
userProvider.userDetailModel.estateNames.indexOf(e),
.map((e) => _buildCard(
0, e, userProvider.userDetailModel.estateNames.indexOf(e),
paid: widget.needFindPayTag
? false
: _unPaidList

@ -169,11 +169,11 @@ class ManagerFunc {
}
static Future<VotingDetailModel> voteDetail(int id) async {
BaseModel baseModel = await NetUtil().get(API.manager.voteDetail,
params: {
'voteId': 1,
},
showMessage: false);
BaseModel baseModel = await NetUtil().get(
API.manager.voteDetail,
params: {'voteId': id},
showMessage: false,
);
return VotingDetailModel.fromJson(baseModel.data);
}

@ -96,7 +96,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
child: ClipOval(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(userProvider.userInfoModel.imgUrl),
image: API.image(userProvider.userInfoModel?.imgUrl ?? ''),
height: 56.w,
width: 56.w,
fit: BoxFit.cover,
@ -107,7 +107,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
),
_buildTile(
'姓名',
userProvider.userInfoModel.name.text.make(),
(userProvider.userInfoModel?.name ?? '').text.make(),
onPressed: () {},
),
_buildTile(
@ -119,7 +119,9 @@ class _UserProfilePageState extends State<UserProfilePage> {
),
_buildTile(
'手机号',
TextUtil.hideNumber(userProvider.userInfoModel.tel).text.make(),
TextUtil.hideNumber(userProvider.userInfoModel?.tel ?? '')
.text
.make(),
onPressed: () {
Get.to(() => UpdateTelPage());
},

@ -4,6 +4,7 @@ import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:akuCommunity/ui/profile/house/house_owners_page.dart';
import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -221,7 +222,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
body: ListView(
children: [
_buildHouseCard(
AppValues.plotName,
S.of(context).tempPlotName,
appProvider.selectedHouse.roomName,
),
_getType(),
@ -236,7 +237,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
List<String> urls = await NetUtil()
.uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.reportRepairInsert(
appProvider.selectedHouse.id,
appProvider.selectedHouse.estateId,
_selectType + 1,
_textEditingController.text,
urls);

@ -306,7 +306,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
child: Column(
children: [
_buildHouseCard(
AppValues.plotName,
S.of(context).tempPlotName,
appProvider.selectedHouse.roomName,
),
_input('访客姓名', '请输入访客姓名', _userName),
@ -315,7 +315,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
_selectTime(),
SizedBox(height: 64.w),
_create(
appProvider.selectedHouse.id,
appProvider.selectedHouse.estateId,
userProvider.userDetailModel.type,
userProvider.userDetailModel.tel,
),

@ -186,6 +186,10 @@ class AppProvider extends ChangeNotifier {
updateHouses(List<HouseModel> items) {
if (items == null) return;
if (items.isEmpty) return;
_selectedHouse = items.firstWhere(
(element) => element.id == (_selectedHouse?.id ?? -1),
orElse: () => null,
);
_houses = items;
notifyListeners();
}

@ -8,7 +8,6 @@ import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/user/user_detail_model.dart';
import 'package:akuCommunity/model/user/user_info_model.dart';
import 'package:akuCommunity/pages/sign/sign_func.dart';
import 'package:akuCommunity/utils/bee_parse.dart';
import 'package:akuCommunity/utils/hive_store.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
@ -20,21 +19,20 @@ class UserProvider extends ChangeNotifier {
bool get isLogin => _isLogin;
bool get isNotLogin => !_isLogin;
Future setLogin(int token) async {
final appProvider = Provider.of<AppProvider>(Get.context,listen: false);
final appProvider = Provider.of<AppProvider>(Get.context, listen: false);
_isLogin = true;
NetUtil().dio.options.headers.putIfAbsent('App-Admin-Token', () => token);
HiveStore.appBox.put('token', token);
HiveStore.appBox.put('login', true);
await updateProfile();
await updateUserDetail();
await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true)
? ''
: _userDetailModel?.estateNames?.first);
await appProvider.updateHouses(await HouseFunc.houses);
notifyListeners();
}
logout() {
final appProvider = Provider.of<AppProvider>(Get.context, listen: false);
appProvider.setCurrentHouse(null);
_isLogin = false;
_token = null;
_userInfoModel = null;
@ -133,13 +131,4 @@ class UserProvider extends ChangeNotifier {
await updateProfile();
}
}
///
String _currentHouse;
int get currentHouseId => BeeParse.getEstateNameId(_currentHouse);
String get currentHouse => BeeParse.getEstateName(_currentHouse);
setCurrentHouse(String house) {
_currentHouse = house;
notifyListeners();
}
}

@ -41,7 +41,7 @@ class ActivityCard extends StatelessWidget {
firstPath == null
? SizedBox()
: Hero(
tag: API.image(firstPath),
tag: firstPath,
child: Material(
color: Colors.grey,
child: FadeInImage.assetNetwork(

@ -104,15 +104,11 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
...model.imgUrls
.map((e) => GestureDetector(
onTap: () {
Get.to(
BeeImagePreview.path(path: API.image(e.url)),
opaque: false,
);
BeeImagePreview.toPath(path: e.url);
},
child: Hero(
tag: API.image(e.url),
tag: e.url,
child: Container(
height: 228.w,
decoration: BoxDecoration(
color: Colors.black12,
borderRadius: BorderRadius.circular(8.w),
@ -120,7 +116,7 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: e.url,
image: API.image(e.url),
fit: BoxFit.cover,
),
),

@ -18,7 +18,17 @@ import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
class AddNewEventPage extends StatefulWidget {
AddNewEventPage({Key key}) : super(key: key);
final int initTopic;
final String topicName;
AddNewEventPage({Key key})
: initTopic = null,
topicName = null,
super(key: key);
AddNewEventPage.topic({
Key key,
@required this.initTopic,
@required this.topicName,
}) : super(key: key);
@override
_AddNewEventPageState createState() => _AddNewEventPageState();
@ -40,12 +50,17 @@ class _AddNewEventPageState extends State<AddNewEventPage> {
}
Map<String, dynamic> params = {
'gambitId': _hotTopicModel == null ? -1 : _hotTopicModel.id,
'content': content,
'isComment': _commentable ? 1 : 0,
'isPublic': 1,
'imgUrls': imgs,
};
if (widget.initTopic != null) {
params.putIfAbsent('gambitId', () => widget.initTopic);
} else {
params.putIfAbsent(
'gambitId', () => _hotTopicModel == null ? -1 : _hotTopicModel.id);
}
BaseModel baseModel = await NetUtil().post(
API.community.addEvent,
@ -187,7 +202,13 @@ class _AddNewEventPageState extends State<AddNewEventPage> {
_buildSelectable(),
Divider(height: 1.w),
28.hb,
_pickTopic(),
if (widget.initTopic == null) _pickTopic(),
Align(
alignment: Alignment.centerLeft,
child: _renderTopic(
HotTopicModel(name: widget.topicName, id: widget.initTopic),
),
),
],
).material(color: Colors.white),
);

@ -36,7 +36,10 @@ class _TopicDetailPageState extends State<TopicDetailPage> {
heroTag: 'event_add',
onPressed: () async {
if (LoginUtil.isNotLogin) return;
bool result = await Get.to(() => AddNewEventPage());
bool result = await Get.to(() => AddNewEventPage.topic(
topicName: widget.model.summary,
initTopic: widget.model.id,
));
},
child: Icon(Icons.add),
),

@ -1,5 +1,6 @@
import 'dart:math';
import 'package:akuCommunity/model/common/img_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -65,9 +66,9 @@ class _ChatCardState extends State<ChatCard> {
borderRadius: BorderRadius.circular(8.w),
),
onPressed: () {
Get.to(
BeeImagePreview.path(path: widget.model.imgUrls.first.url),
opaque: false,
BeeImagePreview.toPath(
path: ImgModel.first(widget.model.imgUrls),
tag: ImgModel.first(widget.model.imgUrls),
);
},
child: ConstrainedBox(
@ -345,7 +346,7 @@ class _ChatCardState extends State<ChatCard> {
shape: StadiumBorder(
side: BorderSide(),
),
),
).pOnly(top: 10.w),
Row(
children: [
64.hb,

@ -1,3 +1,4 @@
import 'package:akuCommunity/model/common/img_model.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@ -76,16 +77,13 @@ class MyEventCard extends StatelessWidget {
? SizedBox(height: 152.w)
: GestureDetector(
onTap: () {
Get.to(
BeeImagePreview.path(
path: model.imgUrl.first.url,
tag: API.image(model.imgUrl.first.url),
),
opaque: false,
BeeImagePreview.toPath(
path: ImgModel.first(model.imgUrl),
tag: ImgModel.first(model.imgUrl),
);
},
child: Hero(
tag: API.image(model.imgUrl.first.url),
tag: ImgModel.first(model.imgUrl),
child: Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
@ -94,7 +92,7 @@ class MyEventCard extends StatelessWidget {
),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(model.imgUrl.first.url),
image: API.image(ImgModel.first(model.imgUrl)),
width: 152.w,
height: 152.w,
fit: BoxFit.cover,

@ -1,3 +1,4 @@
import 'package:akuCommunity/model/common/img_model.dart';
import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart';
@ -84,9 +85,9 @@ class NoticeCard extends StatelessWidget {
? SizedBox(height: 152.w)
: GestureDetector(
onTap: () {
Get.to(
BeeImagePreview.path(path: model.imgUrls.first.url),
opaque: false,
BeeImagePreview.toPath(
path: ImgModel.first(model.imgUrls),
tag: ImgModel.first(model.imgUrls),
);
},
child: Container(
@ -95,15 +96,18 @@ class NoticeCard extends StatelessWidget {
color: Colors.black12,
borderRadius: BorderRadius.circular(8.w),
),
child: Hero(
tag: ImgModel.first(model.imgUrls),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(model.imgUrls.first.url),
image: ImgModel.first(model.imgUrls),
width: 152.w,
height: 152.w,
fit: BoxFit.cover,
),
),
),
),
10.wb,
model.title.text.make().expand(),
],

@ -1,7 +1,10 @@
import 'package:akuCommunity/widget/views/%20bee_download_view.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/const/resource.dart';
@ -48,7 +51,10 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
),
],
),
onPressed: () {},
onPressed: () async {
String result = await Get.dialog(BeeDownloadView(file: path));
if (result != null) OpenFile.open(result);
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w),
side: BorderSide(color: Color(0xFFD4CFBE)),
@ -86,15 +92,11 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
.map(
(e) => GestureDetector(
onTap: () {
Get.to(
BeeImagePreview.path(path: e.url),
opaque: false,
);
BeeImagePreview.toPath(path: e.url, tag: e.url);
},
child: Hero(
tag: e.url,
child: Container(
height: 228.w,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),

@ -1,6 +1,4 @@
import 'dart:async';
import 'dart:math';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -9,7 +7,6 @@ import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/model/community/board_model.dart';
import 'package:akuCommunity/ui/community/notice/notice_detail_page.dart';
import 'package:akuCommunity/ui/community/notice/notice_page.dart';
import 'package:akuCommunity/utils/headers.dart';
@ -22,26 +19,6 @@ class HomeNotification extends StatefulWidget {
}
class _HomeNotificationState extends State<HomeNotification> {
BoardItemModel get randomItem {
if (widget.items.isEmpty) return null;
int index = Random().nextInt(widget.items.length - 1);
return widget.items[index];
}
Timer _timer;
@override
void initState() {
super.initState();
_timer = Timer.periodic(
Duration(milliseconds: 5000), (timer) => setState(() {}));
}
@override
void dispose() {
_timer?.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
@ -57,20 +34,17 @@ class _HomeNotificationState extends State<HomeNotification> {
24.wb,
widget.items.isEmpty
? Spacer()
: GestureDetector(
onTap: () {
if (randomItem != null)
Get.to(() => NoticeDetailPage(id: randomItem.id));
},
child: AnimatedSwitcher(
duration: Duration(milliseconds: 1000),
child: Align(
: Container(
alignment: Alignment.centerLeft,
key: ObjectKey(randomItem),
child: Text(randomItem?.title ?? ''),
height: 85.w,
child: AnimatedTextKit(
animatedTexts: widget.items
.map((e) => RotateAnimatedText(e.title))
.toList(),
repeatForever: true,
),
),
).expand(),
Spacer(),
MaterialButton(
shape: StadiumBorder(),
padding: EdgeInsets.symmetric(horizontal: 12.w),

@ -145,7 +145,7 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
width: 60.w,
),
40.wb,
'${AppValues.plotName}\n${appProvider.selectedHouse.roomName}'
'${S.of(context).tempPlotName}\n${appProvider.selectedHouse.roomName}'
.text
.size(32.sp)
.black

@ -36,7 +36,7 @@ class CarManageCard extends StatelessWidget {
),
),
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: Theme.of(context)
.textTheme
.subtitle2

@ -36,7 +36,7 @@ class CarparkingCard extends StatelessWidget {
),
),
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: Theme.of(context)
.textTheme
.subtitle2

@ -171,7 +171,7 @@ class _AddHousePageState extends State<AddHousePage> {
_renderTile(
title: '小区名称',
item: _renderPicker(
text: AppValues.plotName,
text: S.of(context).tempPlotName,
hintText: '请选择小区',
//
// TODO

@ -109,7 +109,7 @@ class HouseCard extends StatelessWidget {
),
),
onPressed: () {
Get.to(()=>PickMyHousePage());
Get.to(() => PickMyHousePage());
},
shape: RoundedRectangleBorder(
borderRadius:
@ -119,7 +119,7 @@ class HouseCard extends StatelessWidget {
),
12.hb,
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: Theme.of(context).textTheme.headline3,
),
10.hb,

@ -49,7 +49,10 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
return SliverList(
delegate: SliverChildListDelegate(
housesWithoutSelected
.map((e) => _HouseCard(model: e))
.map((e) => _HouseCard(
model: e,
controller: _refreshController,
))
.toList()
.sepWidget(
separate: Divider(
@ -82,6 +85,7 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
child: _HouseCard(
model: appProvider.selectedHouse,
highlight: true,
controller: _refreshController,
),
),
_renderSep,
@ -108,8 +112,13 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
class _HouseCard extends StatelessWidget {
final HouseModel model;
final bool highlight;
const _HouseCard({Key key, @required this.model, this.highlight = false})
: super(key: key);
final EasyRefreshController controller;
const _HouseCard({
Key key,
@required this.model,
this.highlight = false,
@required this.controller,
}) : super(key: key);
bool get canTapSlide {
if (model == null) return false;
return model.status == 4 || model.status == 3 && !highlight;
@ -147,6 +156,8 @@ class _HouseCard extends StatelessWidget {
'ids': [model.id]
},
);
// if(controller.)
controller.callRefresh();
cancel();
}
}
@ -196,7 +207,7 @@ class _HouseCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color:
highlight ? Color(0xFFFF8200) : Color(0xFF333333),

@ -3,3 +3,4 @@ export 'package:akuCommunity/extensions/num_ext.dart';
export 'package:akuCommunity/extensions/widget_list_ext.dart';
export 'package:velocity_x/velocity_x.dart';
export 'package:akuCommunity/const/resource.dart';
export 'package:flutter_gen/gen_l10n/app_localizations.dart';

@ -32,7 +32,8 @@ class LoginUtil {
static bool get isNotLogin => !isLogin;
static bool haveRoom(String name) {
if (!name.contains(RegExp('访客邀请|报事报修|建议咨询|生活缴费|物品出门|投诉表扬|我的访客|我的报修'))) return true;
if (!name.contains(RegExp('访客邀请|报事报修|建议咨询|生活缴费|物品出门|投诉表扬|我的访客|我的报修|我的缴费')))
return true;
final appProvider = Provider.of<AppProvider>(Get.context, listen: false);
if (appProvider.selectedHouse == null) {
BotToast.showText(text: '请先添加房屋');

@ -9,6 +9,34 @@ import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/constants/api.dart';
class BeeImagePreview extends StatefulWidget {
static Future<T> toFile<T>({@required File file, String tag}) async {
return await navigator.push(
PageRouteBuilder(
opaque: false,
pageBuilder: (context, animation, secondAnimation) {
return FadeTransition(
opacity: animation,
child: BeeImagePreview.file(file: file, tag: tag),
);
},
),
);
}
static toPath({@required String path, String tag}) {
navigator.push(
PageRouteBuilder(
opaque: false,
pageBuilder: (context, animation, secondAnimation) {
return FadeTransition(
opacity: animation,
child: BeeImagePreview.path(path: path, tag: tag),
);
},
),
);
}
final File file;
final String path;
final String tag;

@ -0,0 +1,62 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:path_provider/path_provider.dart';
import 'package:akuCommunity/constants/api.dart';
class BeeDownloadView extends StatefulWidget {
final String file;
BeeDownloadView({Key key, this.file}) : super(key: key);
@override
_BeeDownloadViewState createState() => _BeeDownloadViewState();
}
class _BeeDownloadViewState extends State<BeeDownloadView> {
Dio dio = Dio();
double progress;
Future download() async {
Directory dir = await getApplicationDocumentsDirectory();
Directory docPath = Directory('${dir.path}/docs');
if (!await (docPath.exists())) {
await docPath.create();
}
await Future.delayed(Duration(milliseconds: 500));
await dio.download(
API.file(widget.file),
'${docPath.path}/${widget.file.split('/').last}',
onReceiveProgress: (start, all) {
setState(() {
progress = start / all;
});
print('$start,$all');
},
);
Get.back(result: '${docPath.path}/${widget.file.split('/').last}');
}
@override
void initState() {
super.initState();
download();
}
@override
Widget build(BuildContext context) {
return Center(
child: Container(
width: 100,
height: 100,
alignment: Alignment.center,
child: CircularProgressIndicator(value: progress),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
),
),
);
}
}

@ -29,10 +29,7 @@ class BeeGridImageView extends StatelessWidget {
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Get.to(
BeeImagePreview.path(path: urls[index]),
opaque: false,
);
BeeImagePreview.toPath(path: urls[index], tag: urls[index]);
},
child: Hero(
tag: urls[index],

@ -24,6 +24,13 @@ packages:
url: "http://159.75.73.143:8080/third_packages/amap_flutter_map"
source: git
version: "2.0.2-nullsafety"
animated_text_kit:
dependency: "direct main"
description:
name: animated_text_kit
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.1.1"
animator:
dependency: transitive
description:
@ -409,7 +416,7 @@ packages:
source: hosted
version: "4.4.2"
intl:
dependency: transitive
dependency: "direct main"
description:
name: intl
url: "https://pub.flutter-io.cn"
@ -464,6 +471,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0-nullsafety.1"
open_file:
dependency: "direct main"
description:
name: open_file
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.0"
package_info:
dependency: "direct main"
description:

@ -12,17 +12,13 @@ dependencies:
sdk: flutter
flutter_localizations:
sdk: flutter
# 权限组件
intl: ^0.17.0
permission_handler: ^6.1.1
# 版本信息
package_info: ^2.0.0
provider: ^5.0.0
# 屏幕适配
flutter_screenutil: ^5.0.0-nullsafety.11
cupertino_icons: ^1.0.2
# 打电话等各种功能
url_launcher: ^6.0.2
# 工具类
flustars: ^2.0.1
# icons
# TODO need remove
@ -62,7 +58,7 @@ dependencies:
power_logger: ^1.0.0-nullsafety.0
flutter_rating_bar: ^4.0.0
jpush_flutter: ^2.0.1
open_file: ^3.1.0
badges: ^2.0.0-nullsafety.1
amap_flutter_map:
git:
@ -70,6 +66,8 @@ dependencies:
ref: nullsafety
amap_flutter_location: ^1.0.1
amap_flutter_base: ^1.0.2
animated_text_kit: ^4.1.1
dev_dependencies:
flutter_test:
@ -79,6 +77,7 @@ dev_dependencies:
flutter:
uses-material-design: true
generate: true
assets:
- assets/

Loading…
Cancel
Save