Skip to content

Commit

Permalink
Optimize Main ListView
Browse files Browse the repository at this point in the history
  • Loading branch information
rayliverified committed Sep 6, 2024
1 parent de19b7e commit f28f35f
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,46 @@ class MyApp extends StatelessWidget {
const Breakpoint(start: 1081, end: double.infinity, name: DESKTOP),
]),
home: Scaffold(
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Listener(
onPointerDown: (event) {
// Clear Header search TextField focus.
FocusScope.of(context).requestFocus(FocusNode());
},
child: Column(
children: <Widget>[
const MenuHeader(),
const Header(),
const FlutterFavorites(),
// Background squares image container.
Container(
constraints:
const BoxConstraints(maxWidth: 1440, minWidth: 1440),
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/bg_squares.png'),
fit: BoxFit.fitWidth,
alignment: Alignment.center)),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const MostPopular(),
const TopFlutter(),
const TopDart(),
Container(height: 92),
],
),
),
const Footer(),
],
),
),
body: Listener(
onPointerDown: (event) {
// Clear Header search TextField focus.
FocusScope.of(context).requestFocus(FocusNode());
},
child: ListView.builder(
itemCount: blocks.length,
itemBuilder: (context, index) {
return blocks[index];
}),
),
backgroundColor: Colors.white,
),
debugShowCheckedModeBanner: false,
);
}
}

List<Widget> blocks = [
const MenuHeader(),
const Header(),
const FlutterFavorites(),
// Background squares image container.
Container(
constraints: const BoxConstraints(maxWidth: 1440, minWidth: 1440),
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/bg_squares.png'),
fit: BoxFit.fitWidth,
alignment: Alignment.center)),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const MostPopular(),
const TopFlutter(),
const TopDart(),
Container(height: 92),
],
),
),
const Footer(),
];

0 comments on commit f28f35f

Please sign in to comment.