Scaffold(
body: Stack(
children: <Widget>[
// Screen's Background Color
Positioned.fill(
child: Container(
decoration: BoxDecoration(
gradient: RadialGradient(
colors: [Colors.black45, Colors.grey.shade800],
),
),
),
),
SafeArea(
child: CustomScrollView(
physics: BouncingScrollPhysics(),
slivers: [
SliverAppBar(
pinned: true,
elevation: 0.0,
expandedHeight: 100,
backgroundColor: Colors.transparent,
flexibleSpace: FlexibleSpaceBar(
collapseMode: CollapseMode.pin,
title: const Text(
'London',
style: TextStyle(color: Colors.white),
),
titlePadding: EdgeInsets.all(10.0),
),
),
SliverPadding(padding: EdgeInsets.all(50)),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
'35°',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 40,
color: Colors.white,
),
),
Text(
'sunny',
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
),
],
),
SizedBox(height: 5),
Text(
'Mon 40° / 26°',
style: TextStyle(color: Colors.white, fontSize: 20),
),
],
),
),
),
// Hourly Forecast UI
SliverToBoxAdapter(child: HourlyForecastUI()),
// Daily Forecast UI
SliverToBoxAdapter(child: DailyForecastUI()),
// Current Weather Details
SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
delegate: SliverChildBuilderDelegate((context, index) {
final detailsItem = _currentWeatherDetailsList[index];
return CurrentWeatherDetailsListItem(
detailsItem: detailsItem,
);
}, childCount: _currentWeatherDetailsList.length),
),
],
),
),
],
),
);
Scaffold(
body: Stack(
children: <Widget>[
// Screen's Background Color
Positioned.fill(
child: Container(
decoration: BoxDecoration(
gradient: RadialGradient(
colors: [Colors.black45, Colors.grey.shade800],
),
),
),
),
SafeArea(
child: CustomScrollView(
physics: BouncingScrollPhysics(),
slivers: [
SliverAppBar(
pinned: true,
elevation: 0.0,
expandedHeight: 100,
backgroundColor: Colors.transparent,
flexibleSpace: FlexibleSpaceBar(
collapseMode: CollapseMode.pin,
title: const Text(
'London',
style: TextStyle(color: Colors.white),
),
titlePadding: EdgeInsets.all(10.0),
),
),
SliverPadding(padding: EdgeInsets.all(50)),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
'35°',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 40,
color: Colors.white,
),
),
Text(
'sunny',
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
),
],
),
SizedBox(height: 5),
Text(
'Mon 40° / 26°',
style: TextStyle(color: Colors.white, fontSize: 20),
),
],
),
),
),
// Hourly Forecast UI
SliverToBoxAdapter(child: HourlyForecastUI()),
// Daily Forecast UI
SliverToBoxAdapter(child: DailyForecastUI()),
// Current Weather Details
SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
delegate: SliverChildBuilderDelegate((context, index) {
final detailsItem = _currentWeatherDetailsList[index];
return CurrentWeatherDetailsListItem(
detailsItem: detailsItem,
);
}, childCount: _currentWeatherDetailsList.length),
),
],
),
),
],
),
);
