adding packages
This commit is contained in:
@@ -0,0 +1,241 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'responsive_list.dart';
|
||||
import 'views/index.dart';
|
||||
|
||||
export 'package:responsive_scaffold/data/classes/details.dart';
|
||||
|
||||
class ResponsiveListScaffold extends StatelessWidget {
|
||||
ResponsiveListScaffold({
|
||||
this.tabletBreakpoint = 720.0,
|
||||
@required this.detailBuilder,
|
||||
this.appBar,
|
||||
this.drawer,
|
||||
this.slivers,
|
||||
this.endDrawer,
|
||||
@required List<Widget> children,
|
||||
this.primary = true,
|
||||
// this.extendBody = false,
|
||||
this.drawerDragStartBehavior = DragStartBehavior.start,
|
||||
this.backgroundColor,
|
||||
this.bottomNavigationBar,
|
||||
this.bottomSheet,
|
||||
this.floatingActionButton,
|
||||
this.floatingActionButtonAnimator,
|
||||
this.floatingActionButtonLocation,
|
||||
this.persistentFooterButtons,
|
||||
this.resizeToAvoidBottomInset,
|
||||
this.resizeToAvoidBottomPadding,
|
||||
this.tabletItemNotSelected,
|
||||
this.tabletSideMenu,
|
||||
this.nullItems,
|
||||
this.emptyItems,
|
||||
this.tabletFlexDetailView = 8,
|
||||
this.tabletFlexListView = 3,
|
||||
this.scaffoldKey,
|
||||
this.detailScaffoldKey,
|
||||
this.mobileRootNavigator = false,
|
||||
this.mobileNavigator,
|
||||
}) : childDelagate = SliverChildListDelegate(
|
||||
children,
|
||||
addAutomaticKeepAlives: false,
|
||||
addRepaintBoundaries: false,
|
||||
addSemanticIndexes: false,
|
||||
);
|
||||
|
||||
ResponsiveListScaffold.builder({
|
||||
this.tabletBreakpoint = 720.0,
|
||||
@required this.detailBuilder,
|
||||
this.appBar,
|
||||
this.drawer,
|
||||
this.slivers,
|
||||
this.endDrawer,
|
||||
@required int itemCount,
|
||||
@required IndexedWidgetBuilder itemBuilder,
|
||||
this.primary = true,
|
||||
// this.extendBody = false,
|
||||
this.drawerDragStartBehavior = DragStartBehavior.start,
|
||||
this.backgroundColor,
|
||||
this.bottomNavigationBar,
|
||||
this.bottomSheet,
|
||||
this.floatingActionButton,
|
||||
this.nullItems,
|
||||
this.emptyItems,
|
||||
this.floatingActionButtonAnimator,
|
||||
this.floatingActionButtonLocation,
|
||||
this.persistentFooterButtons,
|
||||
this.resizeToAvoidBottomInset,
|
||||
this.resizeToAvoidBottomPadding,
|
||||
this.tabletItemNotSelected,
|
||||
this.tabletSideMenu,
|
||||
this.tabletFlexDetailView = 8,
|
||||
this.tabletFlexListView = 4,
|
||||
this.scaffoldKey,
|
||||
this.detailScaffoldKey,
|
||||
this.mobileRootNavigator = false,
|
||||
this.mobileNavigator,
|
||||
}) : childDelagate = SliverChildBuilderDelegate(
|
||||
itemBuilder,
|
||||
childCount: itemCount,
|
||||
addAutomaticKeepAlives: false,
|
||||
addRepaintBoundaries: false,
|
||||
addSemanticIndexes: false,
|
||||
);
|
||||
|
||||
ResponsiveListScaffold.custom({
|
||||
this.tabletBreakpoint = 720.0,
|
||||
@required this.detailBuilder,
|
||||
this.appBar,
|
||||
this.drawer,
|
||||
this.slivers,
|
||||
this.endDrawer,
|
||||
@required this.childDelagate,
|
||||
this.primary = true,
|
||||
// this.extendBody = false,
|
||||
this.drawerDragStartBehavior = DragStartBehavior.start,
|
||||
this.backgroundColor,
|
||||
this.bottomNavigationBar,
|
||||
this.bottomSheet,
|
||||
this.floatingActionButton,
|
||||
this.nullItems,
|
||||
this.emptyItems,
|
||||
this.floatingActionButtonAnimator,
|
||||
this.floatingActionButtonLocation,
|
||||
this.persistentFooterButtons,
|
||||
this.resizeToAvoidBottomInset,
|
||||
this.resizeToAvoidBottomPadding,
|
||||
this.tabletItemNotSelected,
|
||||
this.tabletSideMenu,
|
||||
this.tabletFlexDetailView = 8,
|
||||
this.tabletFlexListView = 4,
|
||||
this.scaffoldKey,
|
||||
this.detailScaffoldKey,
|
||||
this.mobileRootNavigator = false,
|
||||
this.mobileNavigator,
|
||||
});
|
||||
|
||||
final double tabletBreakpoint;
|
||||
|
||||
final DetailWidgetBuilder detailBuilder;
|
||||
|
||||
final PreferredSizeWidget appBar;
|
||||
|
||||
final Widget drawer, endDrawer;
|
||||
|
||||
final List<Widget> slivers;
|
||||
|
||||
final Widget floatingActionButton;
|
||||
|
||||
final FloatingActionButtonLocation floatingActionButtonLocation;
|
||||
|
||||
final Widget bottomNavigationBar;
|
||||
|
||||
final Widget bottomSheet;
|
||||
|
||||
final List<Widget> persistentFooterButtons;
|
||||
|
||||
final FloatingActionButtonAnimator floatingActionButtonAnimator;
|
||||
|
||||
final bool resizeToAvoidBottomPadding;
|
||||
|
||||
final bool resizeToAvoidBottomInset;
|
||||
|
||||
final bool primary;
|
||||
|
||||
// final bool extendBody;
|
||||
|
||||
final DragStartBehavior drawerDragStartBehavior;
|
||||
|
||||
final Color backgroundColor;
|
||||
|
||||
final Key scaffoldKey, detailScaffoldKey;
|
||||
|
||||
final Widget tabletItemNotSelected;
|
||||
|
||||
final Flexible tabletSideMenu;
|
||||
|
||||
final int tabletFlexListView;
|
||||
|
||||
final int tabletFlexDetailView;
|
||||
|
||||
final bool mobileRootNavigator;
|
||||
|
||||
final NavigatorState mobileNavigator;
|
||||
|
||||
final Widget nullItems, emptyItems;
|
||||
|
||||
final SliverChildDelegate childDelagate;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (_, constraints) {
|
||||
if (constraints.maxWidth >= tabletBreakpoint) {
|
||||
// Tablet
|
||||
return TabletView.custom(
|
||||
key: key,
|
||||
nullItems: nullItems,
|
||||
emptyItems: emptyItems,
|
||||
scaffoldkey: scaffoldKey,
|
||||
detailScaffoldKey: detailScaffoldKey,
|
||||
drawerDragStartBehavior: drawerDragStartBehavior,
|
||||
floatingActionButton: floatingActionButton,
|
||||
floatingActionButtonLocation: floatingActionButtonLocation,
|
||||
bottomNavigationBar: bottomNavigationBar,
|
||||
bottomSheet: bottomSheet,
|
||||
persistentFooterButtons: persistentFooterButtons,
|
||||
floatingActionButtonAnimator: floatingActionButtonAnimator,
|
||||
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
|
||||
resizeToAvoidBottomPadding: resizeToAvoidBottomPadding,
|
||||
primary: primary,
|
||||
// extendBody: extendBody,
|
||||
backgroundColor: backgroundColor,
|
||||
drawer: drawer,
|
||||
endDrawer: endDrawer,
|
||||
appBar: appBar,
|
||||
slivers: slivers,
|
||||
detailBuilder: detailBuilder,
|
||||
childDelagate: childDelagate,
|
||||
flexDetailView: tabletFlexDetailView,
|
||||
flexListView: tabletFlexListView,
|
||||
sideMenu: tabletSideMenu,
|
||||
itemNotSelected: tabletItemNotSelected,
|
||||
);
|
||||
}
|
||||
|
||||
// Mobile
|
||||
return Scaffold(
|
||||
key: scaffoldKey,
|
||||
floatingActionButton: floatingActionButton,
|
||||
floatingActionButtonLocation: floatingActionButtonLocation,
|
||||
bottomNavigationBar: bottomNavigationBar,
|
||||
bottomSheet: bottomSheet,
|
||||
persistentFooterButtons: persistentFooterButtons,
|
||||
floatingActionButtonAnimator: floatingActionButtonAnimator,
|
||||
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
|
||||
resizeToAvoidBottomPadding: resizeToAvoidBottomPadding,
|
||||
primary: primary,
|
||||
// extendBody: extendBody,
|
||||
backgroundColor: backgroundColor,
|
||||
drawer: drawer,
|
||||
endDrawer: endDrawer,
|
||||
appBar: appBar,
|
||||
body: MobileView.custom(
|
||||
useRootNavigator: mobileRootNavigator,
|
||||
nullItems: nullItems,
|
||||
emptyItems: emptyItems,
|
||||
slivers: slivers,
|
||||
detailScaffoldKey: detailScaffoldKey,
|
||||
detailBuilder: detailBuilder,
|
||||
childDelagate: childDelagate,
|
||||
navigator: mobileNavigator,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
typedef DetailWidgetBuilder = DetailsScreen Function(
|
||||
BuildContext context, int index, bool tablet);
|
||||
@@ -0,0 +1,2 @@
|
||||
export 'mobile.dart';
|
||||
export 'tablet.dart';
|
||||
@@ -0,0 +1,136 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../responsive_scaffold.dart';
|
||||
import '../responsive_list.dart';
|
||||
|
||||
class MobileView extends StatelessWidget {
|
||||
MobileView({
|
||||
Key key,
|
||||
@required this.slivers,
|
||||
@required this.detailBuilder,
|
||||
@required List<Widget> children,
|
||||
@required this.detailScaffoldKey,
|
||||
@required this.useRootNavigator,
|
||||
@required this.navigator,
|
||||
@required this.nullItems,
|
||||
@required this.emptyItems,
|
||||
}) : childDelagate = SliverChildListDelegate(
|
||||
children,
|
||||
addAutomaticKeepAlives: false,
|
||||
addRepaintBoundaries: false,
|
||||
addSemanticIndexes: false,
|
||||
),
|
||||
super(key: key);
|
||||
|
||||
MobileView.builder({
|
||||
Key key,
|
||||
@required this.slivers,
|
||||
@required this.detailBuilder,
|
||||
@required int itemCount,
|
||||
@required IndexedWidgetBuilder itemBuilder,
|
||||
@required this.detailScaffoldKey,
|
||||
@required this.useRootNavigator,
|
||||
@required this.navigator,
|
||||
@required this.nullItems,
|
||||
@required this.emptyItems,
|
||||
}) : childDelagate = SliverChildBuilderDelegate(
|
||||
itemBuilder,
|
||||
childCount: itemCount,
|
||||
addAutomaticKeepAlives: false,
|
||||
addRepaintBoundaries: false,
|
||||
addSemanticIndexes: false,
|
||||
),
|
||||
super(key: key);
|
||||
|
||||
MobileView.custom({
|
||||
Key key,
|
||||
@required this.slivers,
|
||||
@required this.detailBuilder,
|
||||
@required this.childDelagate,
|
||||
@required this.detailScaffoldKey,
|
||||
@required this.useRootNavigator,
|
||||
@required this.navigator,
|
||||
@required this.nullItems,
|
||||
@required this.emptyItems,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<Widget> slivers;
|
||||
final DetailWidgetBuilder detailBuilder;
|
||||
final Key detailScaffoldKey;
|
||||
final bool useRootNavigator;
|
||||
final NavigatorState navigator;
|
||||
final Widget nullItems, emptyItems;
|
||||
final SliverChildDelegate childDelagate;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomScrollView(
|
||||
slivers: <Widget>[]
|
||||
..addAll(slivers ?? [])
|
||||
..add(Builder(
|
||||
builder: (BuildContext context) {
|
||||
if (childDelagate?.estimatedChildCount == null && nullItems != null)
|
||||
return SliverFillRemaining(child: nullItems);
|
||||
if (childDelagate?.estimatedChildCount != null &&
|
||||
childDelagate.estimatedChildCount == 0 &&
|
||||
emptyItems != null)
|
||||
return SliverFillRemaining(child: emptyItems);
|
||||
return SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
return new KeepAlive(
|
||||
keepAlive: true,
|
||||
child: new IndexedSemantics(
|
||||
index: index,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
(navigator ?? Navigator.of(context))
|
||||
.push(MaterialPageRoute(builder: (context) {
|
||||
final _details = detailBuilder(context, index, false);
|
||||
return new DetailView(
|
||||
detailScaffoldKey: detailScaffoldKey,
|
||||
itemCount: childDelagate.estimatedChildCount,
|
||||
details: _details);
|
||||
}));
|
||||
},
|
||||
child: new Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: childDelagate.build(context, index),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
childCount: childDelagate?.estimatedChildCount ?? 0,
|
||||
addAutomaticKeepAlives: false,
|
||||
addRepaintBoundaries: false,
|
||||
addSemanticIndexes: false,
|
||||
));
|
||||
},
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DetailView extends StatelessWidget {
|
||||
const DetailView({
|
||||
Key key,
|
||||
@required this.itemCount,
|
||||
@required DetailsScreen details,
|
||||
@required this.detailScaffoldKey,
|
||||
}) : _details = details,
|
||||
super(key: key);
|
||||
|
||||
final int itemCount;
|
||||
final DetailsScreen _details;
|
||||
final Key detailScaffoldKey;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
key: detailScaffoldKey,
|
||||
appBar: _details?.appBar,
|
||||
body: _details.body,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../responsive_scaffold.dart';
|
||||
import '../responsive_list.dart';
|
||||
|
||||
class TabletView extends StatefulWidget {
|
||||
TabletView({
|
||||
Key key,
|
||||
@required this.slivers,
|
||||
@required this.detailBuilder,
|
||||
@required List<Widget> children,
|
||||
@required this.itemNotSelected,
|
||||
@required this.sideMenu,
|
||||
this.flexListView = 4,
|
||||
this.flexDetailView = 8,
|
||||
@required this.appBar,
|
||||
@required this.backgroundColor,
|
||||
@required this.bottomNavigationBar,
|
||||
@required this.bottomSheet,
|
||||
@required this.drawer,
|
||||
@required this.drawerDragStartBehavior,
|
||||
@required this.endDrawer,
|
||||
@required this.floatingActionButton,
|
||||
@required this.floatingActionButtonAnimator,
|
||||
@required this.floatingActionButtonLocation,
|
||||
@required this.persistentFooterButtons,
|
||||
@required this.primary,
|
||||
@required this.resizeToAvoidBottomInset,
|
||||
@required this.resizeToAvoidBottomPadding,
|
||||
@required this.scaffoldkey,
|
||||
@required this.detailScaffoldKey,
|
||||
@required this.nullItems,
|
||||
@required this.emptyItems,
|
||||
}) : childDelagate = SliverChildListDelegate(
|
||||
children,
|
||||
addAutomaticKeepAlives: false,
|
||||
addRepaintBoundaries: false,
|
||||
addSemanticIndexes: false,
|
||||
),
|
||||
super(key: key);
|
||||
|
||||
TabletView.builder({
|
||||
Key key,
|
||||
@required this.slivers,
|
||||
@required this.detailBuilder,
|
||||
@required int itemCount,
|
||||
@required IndexedWidgetBuilder itemBuilder,
|
||||
@required this.itemNotSelected,
|
||||
@required this.sideMenu,
|
||||
this.flexListView = 4,
|
||||
this.flexDetailView = 8,
|
||||
@required this.appBar,
|
||||
@required this.backgroundColor,
|
||||
@required this.bottomNavigationBar,
|
||||
@required this.bottomSheet,
|
||||
@required this.drawer,
|
||||
@required this.drawerDragStartBehavior,
|
||||
@required this.endDrawer,
|
||||
@required this.floatingActionButton,
|
||||
@required this.floatingActionButtonAnimator,
|
||||
@required this.floatingActionButtonLocation,
|
||||
@required this.persistentFooterButtons,
|
||||
@required this.primary,
|
||||
@required this.resizeToAvoidBottomInset,
|
||||
@required this.resizeToAvoidBottomPadding,
|
||||
@required this.scaffoldkey,
|
||||
@required this.detailScaffoldKey,
|
||||
@required this.nullItems,
|
||||
@required this.emptyItems,
|
||||
}) : childDelagate = SliverChildBuilderDelegate(
|
||||
itemBuilder,
|
||||
childCount: itemCount,
|
||||
addAutomaticKeepAlives: false,
|
||||
addRepaintBoundaries: false,
|
||||
addSemanticIndexes: false,
|
||||
),
|
||||
super(key: key);
|
||||
|
||||
TabletView.custom({
|
||||
Key key,
|
||||
@required this.slivers,
|
||||
@required this.detailBuilder,
|
||||
@required this.childDelagate,
|
||||
@required this.itemNotSelected,
|
||||
@required this.sideMenu,
|
||||
this.flexListView = 4,
|
||||
this.flexDetailView = 8,
|
||||
@required this.appBar,
|
||||
@required this.backgroundColor,
|
||||
@required this.bottomNavigationBar,
|
||||
@required this.bottomSheet,
|
||||
@required this.drawer,
|
||||
@required this.drawerDragStartBehavior,
|
||||
@required this.endDrawer,
|
||||
@required this.floatingActionButton,
|
||||
@required this.floatingActionButtonAnimator,
|
||||
@required this.floatingActionButtonLocation,
|
||||
@required this.persistentFooterButtons,
|
||||
@required this.primary,
|
||||
@required this.resizeToAvoidBottomInset,
|
||||
@required this.resizeToAvoidBottomPadding,
|
||||
@required this.scaffoldkey,
|
||||
@required this.detailScaffoldKey,
|
||||
@required this.nullItems,
|
||||
@required this.emptyItems,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<Widget> slivers;
|
||||
final DetailWidgetBuilder detailBuilder;
|
||||
final Widget itemNotSelected;
|
||||
final Flexible sideMenu;
|
||||
final int flexListView;
|
||||
final int flexDetailView;
|
||||
final Widget nullItems, emptyItems;
|
||||
|
||||
final Widget floatingActionButton;
|
||||
|
||||
final FloatingActionButtonLocation floatingActionButtonLocation;
|
||||
|
||||
final Widget bottomNavigationBar;
|
||||
|
||||
final Widget bottomSheet;
|
||||
|
||||
final List<Widget> persistentFooterButtons;
|
||||
|
||||
final FloatingActionButtonAnimator floatingActionButtonAnimator;
|
||||
|
||||
final bool resizeToAvoidBottomPadding;
|
||||
|
||||
final bool resizeToAvoidBottomInset;
|
||||
|
||||
final bool primary;
|
||||
|
||||
final Key scaffoldkey, detailScaffoldKey;
|
||||
|
||||
// final bool extendBody;
|
||||
|
||||
final DragStartBehavior drawerDragStartBehavior;
|
||||
|
||||
final Color backgroundColor;
|
||||
|
||||
final PreferredSizeWidget appBar;
|
||||
|
||||
final Widget drawer, endDrawer;
|
||||
|
||||
final SliverChildDelegate childDelagate;
|
||||
|
||||
@override
|
||||
_TabletViewState createState() => _TabletViewState();
|
||||
}
|
||||
|
||||
class _TabletViewState extends State<TabletView> {
|
||||
int _index;
|
||||
|
||||
void reset() {
|
||||
setState(() {
|
||||
_index = 0;
|
||||
});
|
||||
}
|
||||
|
||||
// void update(DetailsScreen value) {
|
||||
// setState(() {
|
||||
// _index = value;
|
||||
// });
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Flex(
|
||||
direction: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
widget?.sideMenu ?? Container(),
|
||||
Flexible(
|
||||
flex: widget.flexListView,
|
||||
child: Scaffold(
|
||||
key: widget?.scaffoldkey,
|
||||
floatingActionButton: widget?.floatingActionButton,
|
||||
floatingActionButtonLocation:
|
||||
widget?.floatingActionButtonLocation,
|
||||
bottomNavigationBar: widget?.bottomNavigationBar,
|
||||
bottomSheet: widget?.bottomSheet,
|
||||
persistentFooterButtons: widget?.persistentFooterButtons,
|
||||
floatingActionButtonAnimator:
|
||||
widget?.floatingActionButtonAnimator,
|
||||
resizeToAvoidBottomInset: widget?.resizeToAvoidBottomInset,
|
||||
resizeToAvoidBottomPadding: widget?.resizeToAvoidBottomPadding,
|
||||
primary: widget?.primary,
|
||||
// extendBody: extendBody,
|
||||
backgroundColor: widget?.backgroundColor,
|
||||
drawer: widget?.drawer,
|
||||
endDrawer: widget?.endDrawer,
|
||||
appBar: widget?.appBar,
|
||||
body: CustomScrollView(
|
||||
slivers: <Widget>[]
|
||||
..addAll(widget.slivers ?? [])
|
||||
..add(Builder(
|
||||
builder: (BuildContext context) {
|
||||
SliverChildDelegate _childDelagate =
|
||||
widget?.childDelagate;
|
||||
if (_childDelagate?.estimatedChildCount == null &&
|
||||
widget?.nullItems != null)
|
||||
return SliverFillRemaining(child: widget.nullItems);
|
||||
if (_childDelagate?.estimatedChildCount != null &&
|
||||
_childDelagate.estimatedChildCount == 0 &&
|
||||
widget?.emptyItems != null)
|
||||
return SliverFillRemaining(child: widget.emptyItems);
|
||||
return SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
return new KeepAlive(
|
||||
keepAlive: true,
|
||||
child: new IndexedSemantics(
|
||||
index: index,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_index = index;
|
||||
});
|
||||
},
|
||||
child: new Container(
|
||||
color: _index == index
|
||||
? Theme.of(context)
|
||||
.chipTheme
|
||||
.disabledColor
|
||||
: widget?.backgroundColor,
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: _childDelagate.build(context, index),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
childCount: _childDelagate?.estimatedChildCount ?? 0,
|
||||
addAutomaticKeepAlives: false,
|
||||
addRepaintBoundaries: false,
|
||||
addSemanticIndexes: false,
|
||||
));
|
||||
},
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
flex: widget.flexDetailView,
|
||||
child: new _DetailView(
|
||||
detailScaffoldKey: widget?.detailScaffoldKey,
|
||||
details: _index == null ||
|
||||
_index > widget.childDelagate.estimatedChildCount - 1
|
||||
? null
|
||||
: widget.detailBuilder(context, _index, true),
|
||||
itemNotSelected: widget?.itemNotSelected,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _DetailView extends StatelessWidget {
|
||||
const _DetailView({
|
||||
Key key,
|
||||
@required DetailsScreen details,
|
||||
@required this.itemNotSelected,
|
||||
@required this.detailScaffoldKey,
|
||||
}) : _details = details,
|
||||
super(key: key);
|
||||
|
||||
final DetailsScreen _details;
|
||||
final Widget itemNotSelected;
|
||||
final Key detailScaffoldKey;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_details == null) {
|
||||
return itemNotSelected ??
|
||||
Center(
|
||||
child: Text("No Item Selected"),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
key: detailScaffoldKey,
|
||||
appBar: _details?.appBar,
|
||||
body: _details?.body,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user