@@ -89,9 +89,6 @@ class _ManageBookmarksSampleState extends State<ManageBookmarksSample> {
8989 // The build method for the Bookmarks bottom sheet.
9090 Widget buildBookmarks (BuildContext context) {
9191 return Container (
92- constraints: BoxConstraints (
93- maxHeight: MediaQuery .sizeOf (context).height * 0.5 ,
94- ),
9592 padding: EdgeInsets .fromLTRB (
9693 20.0 ,
9794 0.0 ,
@@ -102,42 +99,46 @@ class _ManageBookmarksSampleState extends State<ManageBookmarksSample> {
10299 View .of (context).devicePixelRatio,
103100 ),
104101 ),
105- child: SingleChildScrollView (
106- child: Column (
107- mainAxisSize: MainAxisSize .min,
108- children: [
109- Row (
110- children: [
111- Text (
112- 'Bookmarks' ,
113- style: Theme .of (context).textTheme.titleLarge,
114- ),
115- const Spacer (),
116- IconButton (
117- icon: const Icon (Icons .close),
118- onPressed: () => setState (() => _bookmarksVisible = false ),
119- ),
120- ],
102+ child: Column (
103+ mainAxisSize: MainAxisSize .min,
104+ crossAxisAlignment: CrossAxisAlignment .stretch,
105+ children: [
106+ Row (
107+ children: [
108+ Text (
109+ 'Bookmarks' ,
110+ style: Theme .of (context).textTheme.titleLarge,
111+ ),
112+ const Spacer (),
113+ IconButton (
114+ icon: const Icon (Icons .close),
115+ onPressed: () => setState (() => _bookmarksVisible = false ),
116+ ),
117+ ],
118+ ),
119+ Container (
120+ constraints: BoxConstraints (
121+ maxHeight: MediaQuery .sizeOf (context).height * 0.4 ,
121122 ),
122- // Build the list of bookmarks.
123- ListView . builder (
124- physics : const NeverScrollableScrollPhysics () ,
125- shrinkWrap : true ,
126- itemCount : _bookmarks.length,
127- itemBuilder : (context, index) {
128- // When a bookmark is tapped, set the bookmark on the map view.
129- return TextButton (
130- onPressed : () =>
131- _mapViewController. setBookmark (_bookmarks[index]) ,
132- style : const ButtonStyle (
133- alignment : Alignment .centerLeft ,
134- ),
135- child : Text (_bookmarks[index].name) ,
136- );
137- } ,
123+ child : SingleChildScrollView (
124+ child : Column (
125+ crossAxisAlignment : CrossAxisAlignment .stretch ,
126+ children : _bookmarks. map (
127+ (bookmark) {
128+ // When a bookmark is tapped, set the bookmark on the map view.
129+ return TextButton (
130+ onPressed : () => _mapViewController. setBookmark (bookmark),
131+ style : const ButtonStyle (
132+ alignment : Alignment .centerLeft ,
133+ ),
134+ child : Text (bookmark.name) ,
135+ );
136+ } ,
137+ ). toList (),
138+ ) ,
138139 ),
139- ] ,
140- ) ,
140+ ) ,
141+ ] ,
141142 ),
142143 );
143144 }
0 commit comments