|
|
|
@ -7,7 +7,14 @@ import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
_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
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final appProvider = Provider.of<AppProvider>(context);
|
|
|
|
|
return GridView.builder(
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
gridDelegate:
|
|
|
|
|
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
if (index == appProvider.myApplications.length)
|
|
|
|
|
return _buildTile(allApp);
|
|
|
|
|
return _buildTile(appProvider.myApplications[index]);
|
|
|
|
|
if (index == _items.length) return _buildTile(allApp);
|
|
|
|
|
return _buildTile(_items[index]);
|
|
|
|
|
},
|
|
|
|
|
itemCount: appProvider.myApplications.length + 1,
|
|
|
|
|
itemCount: _items.length + 1,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|