张萌 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 get resource => '$host/static';
static String image(String path) => '$resource$path'; static String image(String path) => '$resource$path';
static String file(String path) => '$resource$path';
static const int networkTimeOut = 10000; static const int networkTimeOut = 10000;
static _Login login = _Login(); static _Login login = _Login();

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

@ -15,6 +15,12 @@ class ImgModel {
sort = json['sort']; 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() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url; data['url'] = this.url;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -186,6 +186,10 @@ class AppProvider extends ChangeNotifier {
updateHouses(List<HouseModel> items) { updateHouses(List<HouseModel> items) {
if (items == null) return; if (items == null) return;
if (items.isEmpty) return; if (items.isEmpty) return;
_selectedHouse = items.firstWhere(
(element) => element.id == (_selectedHouse?.id ?? -1),
orElse: () => null,
);
_houses = items; _houses = items;
notifyListeners(); 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_detail_model.dart';
import 'package:akuCommunity/model/user/user_info_model.dart'; import 'package:akuCommunity/model/user/user_info_model.dart';
import 'package:akuCommunity/pages/sign/sign_func.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/hive_store.dart';
import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart'; import 'package:akuCommunity/utils/network/net_util.dart';
@ -27,14 +26,13 @@ class UserProvider extends ChangeNotifier {
HiveStore.appBox.put('login', true); HiveStore.appBox.put('login', true);
await updateProfile(); await updateProfile();
await updateUserDetail(); await updateUserDetail();
await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true)
? ''
: _userDetailModel?.estateNames?.first);
await appProvider.updateHouses(await HouseFunc.houses); await appProvider.updateHouses(await HouseFunc.houses);
notifyListeners(); notifyListeners();
} }
logout() { logout() {
final appProvider = Provider.of<AppProvider>(Get.context, listen: false);
appProvider.setCurrentHouse(null);
_isLogin = false; _isLogin = false;
_token = null; _token = null;
_userInfoModel = null; _userInfoModel = null;
@ -133,13 +131,4 @@ class UserProvider extends ChangeNotifier {
await updateProfile(); 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 firstPath == null
? SizedBox() ? SizedBox()
: Hero( : Hero(
tag: API.image(firstPath), tag: firstPath,
child: Material( child: Material(
color: Colors.grey, color: Colors.grey,
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(

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

@ -18,7 +18,17 @@ import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/picker/grid_image_picker.dart'; import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
class AddNewEventPage extends StatefulWidget { 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 @override
_AddNewEventPageState createState() => _AddNewEventPageState(); _AddNewEventPageState createState() => _AddNewEventPageState();
@ -40,12 +50,17 @@ class _AddNewEventPageState extends State<AddNewEventPage> {
} }
Map<String, dynamic> params = { Map<String, dynamic> params = {
'gambitId': _hotTopicModel == null ? -1 : _hotTopicModel.id,
'content': content, 'content': content,
'isComment': _commentable ? 1 : 0, 'isComment': _commentable ? 1 : 0,
'isPublic': 1, 'isPublic': 1,
'imgUrls': imgs, '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( BaseModel baseModel = await NetUtil().post(
API.community.addEvent, API.community.addEvent,
@ -187,7 +202,13 @@ class _AddNewEventPageState extends State<AddNewEventPage> {
_buildSelectable(), _buildSelectable(),
Divider(height: 1.w), Divider(height: 1.w),
28.hb, 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), ).material(color: Colors.white),
); );

@ -36,7 +36,10 @@ class _TopicDetailPageState extends State<TopicDetailPage> {
heroTag: 'event_add', heroTag: 'event_add',
onPressed: () async { onPressed: () async {
if (LoginUtil.isNotLogin) return; 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), child: Icon(Icons.add),
), ),

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

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

@ -1,3 +1,4 @@
import 'package:akuCommunity/model/common/img_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
@ -84,9 +85,9 @@ class NoticeCard extends StatelessWidget {
? SizedBox(height: 152.w) ? SizedBox(height: 152.w)
: GestureDetector( : GestureDetector(
onTap: () { onTap: () {
Get.to( BeeImagePreview.toPath(
BeeImagePreview.path(path: model.imgUrls.first.url), path: ImgModel.first(model.imgUrls),
opaque: false, tag: ImgModel.first(model.imgUrls),
); );
}, },
child: Container( child: Container(
@ -95,15 +96,18 @@ class NoticeCard extends StatelessWidget {
color: Colors.black12, color: Colors.black12,
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
), ),
child: Hero(
tag: ImgModel.first(model.imgUrls),
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(model.imgUrls.first.url), image: ImgModel.first(model.imgUrls),
width: 152.w, width: 152.w,
height: 152.w, height: 152.w,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
), ),
),
10.wb, 10.wb,
model.title.text.make().expand(), 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/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/const/resource.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( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
side: BorderSide(color: Color(0xFFD4CFBE)), side: BorderSide(color: Color(0xFFD4CFBE)),
@ -86,15 +92,11 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
.map( .map(
(e) => GestureDetector( (e) => GestureDetector(
onTap: () { onTap: () {
Get.to( BeeImagePreview.toPath(path: e.url, tag: e.url);
BeeImagePreview.path(path: e.url),
opaque: false,
);
}, },
child: Hero( child: Hero(
tag: e.url, tag: e.url,
child: Container( child: Container(
height: 228.w,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),

@ -1,6 +1,4 @@
import 'dart:async'; import 'package:animated_text_kit/animated_text_kit.dart';
import 'dart:math';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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/const/resource.dart';
import 'package:akuCommunity/model/community/board_model.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/ui/community/notice/notice_page.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
@ -22,26 +19,6 @@ class HomeNotification extends StatefulWidget {
} }
class _HomeNotificationState extends State<HomeNotification> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -57,20 +34,17 @@ class _HomeNotificationState extends State<HomeNotification> {
24.wb, 24.wb,
widget.items.isEmpty widget.items.isEmpty
? Spacer() ? Spacer()
: GestureDetector( : Container(
onTap: () {
if (randomItem != null)
Get.to(() => NoticeDetailPage(id: randomItem.id));
},
child: AnimatedSwitcher(
duration: Duration(milliseconds: 1000),
child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
key: ObjectKey(randomItem), height: 85.w,
child: Text(randomItem?.title ?? ''), child: AnimatedTextKit(
animatedTexts: widget.items
.map((e) => RotateAnimatedText(e.title))
.toList(),
repeatForever: true,
), ),
), ),
).expand(), Spacer(),
MaterialButton( MaterialButton(
shape: StadiumBorder(), shape: StadiumBorder(),
padding: EdgeInsets.symmetric(horizontal: 12.w), padding: EdgeInsets.symmetric(horizontal: 12.w),

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

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

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

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

@ -119,7 +119,7 @@ class HouseCard extends StatelessWidget {
), ),
12.hb, 12.hb,
Text( Text(
AppValues.plotName, S.of(context).tempPlotName,
style: Theme.of(context).textTheme.headline3, style: Theme.of(context).textTheme.headline3,
), ),
10.hb, 10.hb,

@ -49,7 +49,10 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
return SliverList( return SliverList(
delegate: SliverChildListDelegate( delegate: SliverChildListDelegate(
housesWithoutSelected housesWithoutSelected
.map((e) => _HouseCard(model: e)) .map((e) => _HouseCard(
model: e,
controller: _refreshController,
))
.toList() .toList()
.sepWidget( .sepWidget(
separate: Divider( separate: Divider(
@ -82,6 +85,7 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
child: _HouseCard( child: _HouseCard(
model: appProvider.selectedHouse, model: appProvider.selectedHouse,
highlight: true, highlight: true,
controller: _refreshController,
), ),
), ),
_renderSep, _renderSep,
@ -108,8 +112,13 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
class _HouseCard extends StatelessWidget { class _HouseCard extends StatelessWidget {
final HouseModel model; final HouseModel model;
final bool highlight; final bool highlight;
const _HouseCard({Key key, @required this.model, this.highlight = false}) final EasyRefreshController controller;
: super(key: key); const _HouseCard({
Key key,
@required this.model,
this.highlight = false,
@required this.controller,
}) : super(key: key);
bool get canTapSlide { bool get canTapSlide {
if (model == null) return false; if (model == null) return false;
return model.status == 4 || model.status == 3 && !highlight; return model.status == 4 || model.status == 3 && !highlight;
@ -147,6 +156,8 @@ class _HouseCard extends StatelessWidget {
'ids': [model.id] 'ids': [model.id]
}, },
); );
// if(controller.)
controller.callRefresh();
cancel(); cancel();
} }
} }
@ -196,7 +207,7 @@ class _HouseCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
AppValues.plotName, S.of(context).tempPlotName,
style: Theme.of(context).textTheme.subtitle1.copyWith( style: Theme.of(context).textTheme.subtitle1.copyWith(
color: color:
highlight ? Color(0xFFFF8200) : Color(0xFF333333), 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:akuCommunity/extensions/widget_list_ext.dart';
export 'package:velocity_x/velocity_x.dart'; export 'package:velocity_x/velocity_x.dart';
export 'package:akuCommunity/const/resource.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 get isNotLogin => !isLogin;
static bool haveRoom(String name) { 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); final appProvider = Provider.of<AppProvider>(Get.context, listen: false);
if (appProvider.selectedHouse == null) { if (appProvider.selectedHouse == null) {
BotToast.showText(text: '请先添加房屋'); BotToast.showText(text: '请先添加房屋');

@ -9,6 +9,34 @@ import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/constants/api.dart';
class BeeImagePreview extends StatefulWidget { 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 File file;
final String path; final String path;
final String tag; 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) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Get.to( BeeImagePreview.toPath(path: urls[index], tag: urls[index]);
BeeImagePreview.path(path: urls[index]),
opaque: false,
);
}, },
child: Hero( child: Hero(
tag: urls[index], tag: urls[index],

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

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

Loading…
Cancel
Save