I want to have Navigator Widget in the CustomScrollView(CustomScrollView as a parent of Navigator) but It gives an error in my flutter app:
constraints.biggest.isFinite is not true
My Code:
import 'package:flutter/material.dart';
class Example extends StatelessWidget {
const Example({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Navigator(
onGenerateRoute: (settings) {
return MaterialPageRoute(builder: (BuildContext context) {
return Scaffold(
body: Column(
children: [Text('some Teext')],
),
);
});
},
),
)
],
);
}
}
I know that If I wrap my Navigator widget with SizedBox having specific height, the error will be gone but I don’t want specific height.
I want to add CustomScrollView because I want my top app bar as floating on the screen as well as above my Navigator. Basically this navigator is a nested navigator.
Thanks in advance.I Appreciate your answers.
2
Answers
The issue is about constraints , you can use
SliverFillRemaining
You can use a
NestedScrollView
to achieve what you are looking for.Here you have an example:
Beware of a limitation: nesting multiple
NestedScrollView
s one inside another results in an overflow issue. See more here.