Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 58 additions & 47 deletions lib/pages/main/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import 'dart:async';
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:mosquito_alert_app/pages/main/components/custom_card_widget.dart';
import 'package:mosquito_alert_app/pages/map/public_map.dart';
import 'package:mosquito_alert_app/pages/notification_pages/notifications_page.dart';
import 'package:mosquito_alert_app/utils/MyLocalizations.dart';
import 'package:mosquito_alert_app/utils/Utils.dart';
import 'package:mosquito_alert_app/utils/style.dart';
Expand Down Expand Up @@ -34,7 +33,38 @@ class _HomePageState extends State<HomePage> {
children: <Widget>[
Scaffold(
appBar: AppBar(
title: Text(MyLocalizations.of(context, "home_tab")),
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
MyLocalizations.of(context, "app_name"),
style: TextStyle(
color: Color(0xFFEDB20C),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you define this color as primary in themedata and reference it from there?

fontWeight: FontWeight.bold,
),
),
],
),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.notifications_outlined,
color: Colors.black,
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => NotificationsPage()),
);
},
)
],
bottom: PreferredSize(
child: Container(
color: Colors.black,
height: 0.25,
),
preferredSize: Size.fromHeight(4.0)),
),
body: LayoutBuilder(
builder: (BuildContext context, BoxConstraints viewportConstraints) {
Expand All @@ -46,19 +76,11 @@ class _HomePageState extends State<HomePage> {
child: IntrinsicHeight(
child: Stack(
children: <Widget>[
Container(
alignment: Alignment.bottomCenter,
child: Image.asset(
'assets/img/bottoms/bottom_main.png',
width: double.infinity,
fit: BoxFit.fitWidth,
alignment: Alignment.bottomCenter,
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 24,
Expand Down Expand Up @@ -100,41 +122,28 @@ class _HomePageState extends State<HomePage> {
reportFunction: _createSiteReport
),
SizedBox(height: 30),
Material(
elevation: 5.0,
borderRadius: BorderRadius.circular(100),
child: Container(
height: 60.0,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(100),
),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => PublicMap()),
);
},
child: Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 10.0),
child: SvgPicture.asset('assets/img/maps/public-map-icon.svg', width: 50,),
),
SizedBox(width: 15),
Expanded(
child: Text(
MyLocalizations.of(context, 'public_map_tab'),
style: TextStyle(
fontSize: 18,
color: Colors.grey[600]
),
),
),
],
),
),
Text(
"Information pills (HC)",
style: TextStyle(
fontFamily: "Nunito",
fontSize: 18.0, // TODO: Change to use TextTheme after the other PR is merged
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending before merge

fontWeight: FontWeight.w400,
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(3, (index) {
return Container(
margin: EdgeInsets.all(20.0),
width: 200.0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure dynamic value depending on the screen width, so always 1 box and a half appears in the screen

height: 150.0,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(16.0),
),
);
}),
),
)
],
Expand All @@ -149,6 +158,8 @@ class _HomePageState extends State<HomePage> {
},
)
),

// TODO: Can we remove the Positioned.fill?
Positioned.fill(
child: StreamBuilder<bool>(
stream: loadingStream.stream,
Expand Down
Loading