Migrate to auto_router

This commit is contained in:
2022-09-03 14:46:00 -04:00
parent 7ca45d2f70
commit 1c7f353e5f
11 changed files with 625 additions and 463 deletions

View File

@@ -15,96 +15,93 @@ class EventsScreen extends StatelessWidget {
body: Container(
color: Colors.grey[100],
child: SafeArea(
child: Padding(
padding: const EdgeInsets.only(bottom: kBottomNavigationBarHeight),
child: Stack(
fit: StackFit.loose,
children: [
SizedBox(
width: double.infinity,
height: double.infinity,
child: Align(
alignment: Alignment.topLeft,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 30),
width: double.infinity,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(Icons.calendar_month_outlined, size: 35, color: Colors.grey[700]),
const SizedBox(width: 12),
Text("Events", style: furmanTextStyle(TextStyle(color: Colors.grey[900], fontSize: 28, fontWeight: FontWeight.w700))),
],
),
],
),
),
),
),
ScrollViewWithHeight(
child: Stack(
fit: StackFit.loose,
children: [
SizedBox(
width: double.infinity,
height: double.infinity,
child: Align(
alignment: Alignment.topLeft,
child: Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
),
padding: const EdgeInsets.symmetric(vertical: 20),
margin: const EdgeInsets.only(top: 100),
padding: const EdgeInsets.symmetric(horizontal: 30),
width: double.infinity,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const HeaderWidget(title: "Today"),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: EventsList()
),
const HeaderWidget(title: "Tomorrow"),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: EventsList(dateRange: constructDateRange(
DateTime.now().add(const Duration(days: 1)),
DateTime.now().add(const Duration(days: 1)),
)),
),
...[for(var i=2; i<7; i+=1) i].map((i) {
var date = DateTime.now().add(Duration(days: i));
var dayName = DateFormat('EEEE').format(date);
return Wrap(
children: [
HeaderWidget(title: dayName),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: EventsList(dateRange: constructDateRange(
date,
date,
)),
),
],
);
}),
Center(child:
Wrap(
direction: Axis.vertical,
crossAxisAlignment: WrapCrossAlignment.center,
children: const [
Text("Need more events?"),
Text("Syncdin"),
Text("Athletics"),
Text("CLPs"),
],
),
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(Icons.calendar_month_outlined, size: 35, color: Colors.grey[700]),
const SizedBox(width: 12),
Text("Events", style: furmanTextStyle(TextStyle(color: Colors.grey[900], fontSize: 28, fontWeight: FontWeight.w700))),
],
),
],
),
),
),
],
),
),
ScrollViewWithHeight(
child: Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
),
padding: const EdgeInsets.symmetric(vertical: 20),
margin: const EdgeInsets.only(top: 100),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const HeaderWidget(title: "Today"),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: EventsList()
),
const HeaderWidget(title: "Tomorrow"),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: EventsList(dateRange: constructDateRange(
DateTime.now().add(const Duration(days: 1)),
DateTime.now().add(const Duration(days: 1)),
)),
),
...[for(var i=2; i<7; i+=1) i].map((i) {
var date = DateTime.now().add(Duration(days: i));
var dayName = DateFormat('EEEE').format(date);
return Wrap(
children: [
HeaderWidget(title: dayName),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: EventsList(dateRange: constructDateRange(
date,
date,
)),
),
],
);
}),
Center(child:
Wrap(
direction: Axis.vertical,
crossAxisAlignment: WrapCrossAlignment.center,
children: const [
Text("Need more events?"),
Text("Syncdin"),
Text("Athletics"),
Text("CLPs"),
],
),
),
],
),
),
),
],
),
),
),

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:furman_now/src/routes/index.gr.dart';
import 'package:furman_now/src/utils/greeting.dart';
import 'package:furman_now/src/utils/theme.dart';
import 'package:furman_now/src/widgets/header.dart';
@@ -18,7 +19,6 @@ class HomeScreen extends StatelessWidget {
child: SafeArea(
child: Container(
color: Colors.grey[100],
padding: const EdgeInsets.only(bottom: kBottomNavigationBarHeight),
child: Stack(
fit: StackFit.loose,
children: [
@@ -68,7 +68,7 @@ class HomeScreen extends StatelessWidget {
children: [
const HeaderWidget(
title: "Today's Events",
link: HeaderLink(text: "View more", href: ""),
link: HeaderLink(text: "View more", href: EventsRoute()),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),

View File

@@ -12,75 +12,72 @@ class InfoScreen extends StatelessWidget {
body: Container(
color: Colors.grey[100],
child: SafeArea(
child: Padding(
padding: const EdgeInsets.only(bottom: kBottomNavigationBarHeight),
child: Stack(
fit: StackFit.loose,
children: [
SizedBox(
width: double.infinity,
height: double.infinity,
child: Align(
alignment: Alignment.topLeft,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 30),
width: double.infinity,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(Icons.info_outline, size: 35, color: Colors.grey[700]),
const SizedBox(width: 12),
Text("Info", style: furmanTextStyle(TextStyle(color: Colors.grey[900], fontSize: 28, fontWeight: FontWeight.w700))),
],
),
],
),
),
),
),
ScrollViewWithHeight(
child: Stack(
fit: StackFit.loose,
children: [
SizedBox(
width: double.infinity,
height: double.infinity,
child: Align(
alignment: Alignment.topLeft,
child: Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
),
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
margin: const EdgeInsets.only(top: 100),
padding: const EdgeInsets.symmetric(horizontal: 30),
width: double.infinity,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InfoCard(
color: Colors.red.shade50,
icon: Icons.local_hospital,
title: "Health and Safety",
description: "Important contact information and links regarding student health and safety.",
),
const SizedBox(height: 10),
InfoCard(
color: Colors.deepPurple.shade50,
icon: Icons.phone,
title: "Contacts",
description: "Important contact information and links regarding student health and safety.",
),
const SizedBox(height: 10),
InfoCard(
color: Colors.blue.shade50,
icon: Icons.access_time,
title: "Hours",
description: "Important contact information and links regarding student health and safety.",
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(Icons.info_outline, size: 35, color: Colors.grey[700]),
const SizedBox(width: 12),
Text("Info", style: furmanTextStyle(TextStyle(color: Colors.grey[900], fontSize: 28, fontWeight: FontWeight.w700))),
],
),
],
),
),
),
],
),
),
ScrollViewWithHeight(
child: Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
),
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
margin: const EdgeInsets.only(top: 100),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InfoCard(
color: Colors.red.shade50,
icon: Icons.local_hospital,
title: "Health and Safety",
description: "Important contact information and links regarding student health and safety.",
),
const SizedBox(height: 10),
InfoCard(
color: Colors.deepPurple.shade50,
icon: Icons.phone,
title: "Contacts",
description: "Important contact information and links regarding student health and safety.",
),
const SizedBox(height: 10),
InfoCard(
color: Colors.blue.shade50,
icon: Icons.access_time,
title: "Hours",
description: "Important contact information and links regarding student health and safety.",
),
],
),
),
),
],
),
),
),

View File

@@ -82,145 +82,142 @@ class _MapScreenState extends State<MapScreen>
color: const Color(0xffb7acc9),
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.only(bottom: kBottomNavigationBarHeight),
child: Stack(
children: [
FlutterMap(
mapController: _mapController,
options: MapOptions(
center: LatLng(34.925926, -82.439397),
enableMultiFingerGestureRace: true,
rotationWinGestures: MultiFingerGesture.all,
pinchZoomThreshold: 0.2,
rotationThreshold: 8,
zoom: 15,
minZoom: 12,
maxZoom: 18,
plugins: [
LocationMarkerPlugin(
centerCurrentLocationStream:
_centerCurrentLocationStreamController.stream,
centerOnLocationUpdate: _centerOnLocationUpdate,
),
],
onPositionChanged: (MapPosition position, bool hasGesture) {
if (hasGesture) {
setState(
() => _centerOnLocationUpdate = CenterOnLocationUpdate.never,
);
}
child: Stack(
children: [
FlutterMap(
mapController: _mapController,
options: MapOptions(
center: LatLng(34.925926, -82.439397),
enableMultiFingerGestureRace: true,
rotationWinGestures: MultiFingerGesture.all,
pinchZoomThreshold: 0.2,
rotationThreshold: 8,
zoom: 15,
minZoom: 12,
maxZoom: 18,
plugins: [
LocationMarkerPlugin(
centerCurrentLocationStream:
_centerCurrentLocationStreamController.stream,
centerOnLocationUpdate: _centerOnLocationUpdate,
),
],
onPositionChanged: (MapPosition position, bool hasGesture) {
if (hasGesture) {
setState(
() => _centerOnLocationUpdate = CenterOnLocationUpdate.never,
);
}
},
),
layers: [
TileLayerOptions(
urlTemplate:
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
userAgentPackageName: 'edu.furman.now',
),
LocationMarkerLayerOptions(),
],
nonRotatedChildren: [
AttributionWidget(
attributionBuilder: (BuildContext context) {
return const ColoredBox(
color: Color(0xCCFFFFFF),
child: Padding(
padding: EdgeInsets.all(3),
child: Text("©️ OpenStreetMap contributors"),
),
);
},
),
layers: [
TileLayerOptions(
urlTemplate:
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
userAgentPackageName: 'edu.furman.now',
),
LocationMarkerLayerOptions(),
],
nonRotatedChildren: [
AttributionWidget(
attributionBuilder: (BuildContext context) {
return const ColoredBox(
color: Color(0xCCFFFFFF),
child: Padding(
padding: EdgeInsets.all(3),
child: Text("©️ OpenStreetMap contributors"),
],
),
// Rotation reset fab
Positioned(
top: 12,
left: 0,
right: 0,
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Container(
width: double.infinity,
height: 50,
padding: const EdgeInsets.only(left: 10, right: 20),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(60)),
boxShadow: [
BoxShadow(
color: Color(0x33000000),
blurRadius: 8,
),
],
),
);
},
),
],
),
// Rotation reset fab
Positioned(
top: 12,
left: 0,
right: 0,
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Container(
width: double.infinity,
height: 50,
padding: const EdgeInsets.only(left: 10, right: 20),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(60)),
boxShadow: [
BoxShadow(
color: Color(0x33000000),
blurRadius: 8,
child: Stack(
children: [
Align(
alignment: Alignment.centerLeft,
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
SvgPicture.asset("assets/images/bell-tower.svg", color: Theme.of(context).primaryColor, height: 32),
const SizedBox(width: 10),
Text(
"Search locations",
style: furmanTextStyle(TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.grey.shade500,
)),
),
],
),
],
),
child: Stack(
children: [
Align(
alignment: Alignment.centerLeft,
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
SvgPicture.asset("assets/images/bell-tower.svg", color: Theme.of(context).primaryColor, height: 32),
const SizedBox(width: 10),
Text(
"Search locations",
style: furmanTextStyle(TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.grey.shade500,
)),
),
],
),
),
],
),
),
),
// const SizedBox(height: 12),
SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
scrollDirection: Axis.horizontal,
child: Wrap(
spacing: 6,
children: const [
MapFilterChip(icon: Icons.restaurant, text: "Restaurants"),
MapFilterChip(icon: Icons.train, text: "Transportation"),
MapFilterChip(icon: Icons.school, text: "Campus Buildings"),
),
],
),
),
MapRotateCompass(rotation: _rotation, resetRotation: resetRotation),
],
),
),
// const SizedBox(height: 12),
SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
scrollDirection: Axis.horizontal,
child: Wrap(
spacing: 6,
children: const [
MapFilterChip(icon: Icons.restaurant, text: "Restaurants"),
MapFilterChip(icon: Icons.train, text: "Transportation"),
MapFilterChip(icon: Icons.school, text: "Campus Buildings"),
],
),
),
MapRotateCompass(rotation: _rotation, resetRotation: resetRotation),
],
),
),
Positioned(
right: 20,
bottom: 20,
child: FloatingActionButton(
onPressed: () {
// Automatically center the location marker on the map when location updated until user interact with the map.
setState(
() => _centerOnLocationUpdate = CenterOnLocationUpdate.always,
);
// Center the location marker on the map and zoom the map to level 18.
_centerCurrentLocationStreamController.add(16);
},
child: const Icon(
Icons.my_location,
color: Colors.white,
),
)
),
Positioned(
right: 20,
bottom: 20,
child: FloatingActionButton(
onPressed: () {
// Automatically center the location marker on the map when location updated until user interact with the map.
setState(
() => _centerOnLocationUpdate = CenterOnLocationUpdate.always,
);
// Center the location marker on the map and zoom the map to level 18.
_centerCurrentLocationStreamController.add(16);
},
child: const Icon(
Icons.my_location,
color: Colors.white,
),
)
],
),
)
],
),
),
),