物业页面应用卡片重写

hmxc
小赖 4 years ago
parent 10fefc751c
commit 707950a1f2

@ -133,13 +133,6 @@ class _MarketPageState extends State<MarketPage>
imagePath: 'assets/example/guanggao5.png', imagePath: 'assets/example/guanggao5.png',
radius: 36, radius: 36,
), ),
ContainerComment(
radius: 8,
customWidget: GridButtons(
gridList: [],
crossCount: 4,
),
),
], ],
), ),
), ),

@ -1,5 +1,7 @@
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/constants/application_objects.dart';
import 'package:akuCommunity/ui/community/notice/notice_page.dart'; import 'package:akuCommunity/ui/community/notice/notice_page.dart';
import 'package:akuCommunity/widget/views/application_view.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -202,10 +204,7 @@ class _PropertyIndexState extends State<PropertyIndex>
SliverToBoxAdapter( SliverToBoxAdapter(
child: ContainerComment( child: ContainerComment(
radius: 8, radius: 8,
customWidget: GridButtons( customWidget: ApplicationView.custom(items: smartManagerApp),
gridList: _gridList,
crossCount: 4,
),
), ),
), ),
SliverToBoxAdapter( SliverToBoxAdapter(

@ -7,7 +7,14 @@ import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class ApplicationView extends StatefulWidget { class ApplicationView extends StatefulWidget {
ApplicationView({Key key}) : super(key: key); final List<AO> items;
ApplicationView({Key key})
: items = null,
super(key: key);
ApplicationView.custom({Key key, @required this.items})
: assert(items != null),
super(key: key);
@override @override
_ApplicationViewState createState() => _ApplicationViewState(); _ApplicationViewState createState() => _ApplicationViewState();
@ -34,19 +41,24 @@ class _ApplicationViewState extends State<ApplicationView> {
); );
} }
bool get _isCustom => widget.items != null;
List<AO> get _items {
final appProvider = Provider.of<AppProvider>(context);
return _isCustom ? widget.items : appProvider.myApplications;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context);
return GridView.builder( return GridView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
gridDelegate: gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4), SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index == appProvider.myApplications.length) if (index == _items.length) return _buildTile(allApp);
return _buildTile(allApp); return _buildTile(_items[index]);
return _buildTile(appProvider.myApplications[index]);
}, },
itemCount: appProvider.myApplications.length + 1, itemCount: _items.length + 1,
shrinkWrap: true, shrinkWrap: true,
); );
} }

Loading…
Cancel
Save