Initial pull-down gesture for student ID, added global app state
This commit is contained in:
parent
95400d7ee2
commit
4256293d10
|
@ -1,20 +1,32 @@
|
||||||
PODS:
|
PODS:
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
|
- flutter_compass (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- geolocator_apple (1.2.0):
|
||||||
|
- Flutter
|
||||||
- path_provider_ios (0.0.1):
|
- path_provider_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
|
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
|
||||||
|
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
|
||||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
|
flutter_compass:
|
||||||
|
:path: ".symlinks/plugins/flutter_compass/ios"
|
||||||
|
geolocator_apple:
|
||||||
|
:path: ".symlinks/plugins/geolocator_apple/ios"
|
||||||
path_provider_ios:
|
path_provider_ios:
|
||||||
:path: ".symlinks/plugins/path_provider_ios/ios"
|
:path: ".symlinks/plugins/path_provider_ios/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
|
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
|
||||||
|
flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855
|
||||||
|
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
|
||||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
||||||
|
|
||||||
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:furman_now/src/app.dart';
|
import 'package:furman_now/src/app.dart';
|
||||||
|
import 'package:furman_now/src/store/index.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(App());
|
runApp(
|
||||||
|
ChangeNotifierProvider(
|
||||||
|
create: (context) => AppState(),
|
||||||
|
child: App(),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_remix/flutter_remix.dart';
|
||||||
import 'package:furman_now/src/routes/index.gr.dart';
|
import 'package:furman_now/src/routes/index.gr.dart';
|
||||||
|
import 'package:salomon_bottom_bar/salomon_bottom_bar.dart';
|
||||||
|
|
||||||
class MainLayout extends StatefulWidget {
|
class MainLayout extends StatefulWidget {
|
||||||
const MainLayout({
|
const MainLayout({
|
||||||
|
@ -34,7 +36,9 @@ class _MainLayoutState extends State<MainLayout> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AutoTabsScaffold(
|
return AutoTabsScaffold(
|
||||||
routes: const [
|
routes: const [
|
||||||
HomeRoute(),
|
HomePageRouter(children: [
|
||||||
|
HomeRoute(),
|
||||||
|
]),
|
||||||
MapRoute(),
|
MapRoute(),
|
||||||
EventsRoute(),
|
EventsRoute(),
|
||||||
InfoRoute(),
|
InfoRoute(),
|
||||||
|
@ -59,29 +63,32 @@ class _MainLayoutState extends State<MainLayout> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: BottomNavigationBar(
|
child: Padding(
|
||||||
items: const <BottomNavigationBarItem>[
|
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 20),
|
||||||
BottomNavigationBarItem(
|
child: SalomonBottomBar(
|
||||||
icon: Icon(Icons.home),
|
items: <SalomonBottomBarItem>[
|
||||||
label: 'Home',
|
SalomonBottomBarItem(
|
||||||
),
|
icon: const Icon(FlutterRemix.home_line),
|
||||||
BottomNavigationBarItem(
|
title: const Text('Home'),
|
||||||
icon: Icon(Icons.map),
|
),
|
||||||
label: 'Map',
|
SalomonBottomBarItem(
|
||||||
),
|
icon: const Icon(FlutterRemix.map_2_line),
|
||||||
BottomNavigationBarItem(
|
title: const Text('Map'),
|
||||||
icon: Icon(Icons.calendar_month),
|
),
|
||||||
label: 'Events',
|
SalomonBottomBarItem(
|
||||||
),
|
icon: const Icon(FlutterRemix.calendar_line),
|
||||||
BottomNavigationBarItem(
|
title: const Text('Events'),
|
||||||
icon: Icon(Icons.info_outline),
|
),
|
||||||
label: 'Info',
|
SalomonBottomBarItem(
|
||||||
),
|
icon: const Icon(FlutterRemix.information_line),
|
||||||
],
|
title: const Text('Info'),
|
||||||
currentIndex: tabsRouter.activeIndex,
|
),
|
||||||
selectedItemColor: Theme.of(context).primaryColor,
|
],
|
||||||
unselectedItemColor: Colors.grey[600],
|
currentIndex: tabsRouter.activeIndex,
|
||||||
onTap: tabsRouter.setActiveIndex,
|
selectedItemColor: Theme.of(context).primaryColor,
|
||||||
|
unselectedItemColor: Colors.grey[600],
|
||||||
|
onTap: tabsRouter.setActiveIndex,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:furman_now/src/screens/home/index.dart';
|
||||||
import 'package:furman_now/src/screens/info/index.dart';
|
import 'package:furman_now/src/screens/info/index.dart';
|
||||||
import 'package:furman_now/src/screens/map/index.dart';
|
import 'package:furman_now/src/screens/map/index.dart';
|
||||||
import 'package:furman_now/src/screens/student_id/index.dart';
|
import 'package:furman_now/src/screens/student_id/index.dart';
|
||||||
|
import 'package:furman_now/src/utils/hero_empty_router_page.dart';
|
||||||
|
|
||||||
import '../layouts/main/index.dart';
|
import '../layouts/main/index.dart';
|
||||||
|
|
||||||
|
@ -11,17 +12,28 @@ import '../layouts/main/index.dart';
|
||||||
replaceInRouteName: 'Screen,Route',
|
replaceInRouteName: 'Screen,Route',
|
||||||
routes: <AutoRoute>[
|
routes: <AutoRoute>[
|
||||||
AutoRoute(path: "/", page: MainLayout, children: [
|
AutoRoute(path: "/", page: MainLayout, children: [
|
||||||
AutoRoute(path: "home", page: HomeScreen),
|
AutoRoute(path: "home", name: "HomePageRouter", page: HeroEmptyRouterPage, children: [
|
||||||
|
CustomRoute(
|
||||||
|
path: "",
|
||||||
|
page: HomeScreen,
|
||||||
|
transitionsBuilder: TransitionsBuilders.noTransition,
|
||||||
|
),
|
||||||
|
CustomRoute(
|
||||||
|
path: "student-id",
|
||||||
|
page: StudentIdScreen,
|
||||||
|
transitionsBuilder: TransitionsBuilders.noTransition,
|
||||||
|
),
|
||||||
|
]),
|
||||||
AutoRoute(path: "map", page: MapScreen),
|
AutoRoute(path: "map", page: MapScreen),
|
||||||
AutoRoute(path: "events", page: EventsScreen),
|
AutoRoute(path: "events", page: EventsScreen),
|
||||||
AutoRoute(path: "info", page: InfoScreen),
|
AutoRoute(path: "info", page: InfoScreen),
|
||||||
]),
|
]),
|
||||||
CustomRoute(
|
// AutoRoute(
|
||||||
path: "/student-id",
|
// path: "/student-id",
|
||||||
page: StudentIdScreen,
|
// page: StudentIdScreen,
|
||||||
transitionsBuilder: TransitionsBuilders.slideTop,
|
// // transitionsBuilder: TransitionsBuilders.slideTop,
|
||||||
durationInMilliseconds: 200,
|
// // durationInMilliseconds: 200,
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
class $AppRouter {}
|
class $AppRouter {}
|
|
@ -11,112 +11,135 @@
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
|
|
||||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
import 'package:auto_route/auto_route.dart' as _i7;
|
import 'package:auto_route/auto_route.dart' as _i8;
|
||||||
import 'package:flutter/material.dart' as _i8;
|
import 'package:flutter/material.dart' as _i9;
|
||||||
|
|
||||||
import '../layouts/main/index.dart' as _i1;
|
import '../layouts/main/index.dart' as _i1;
|
||||||
import '../screens/events/index.dart' as _i5;
|
import '../screens/events/index.dart' as _i4;
|
||||||
import '../screens/home/index.dart' as _i3;
|
import '../screens/home/index.dart' as _i6;
|
||||||
import '../screens/info/index.dart' as _i6;
|
import '../screens/info/index.dart' as _i5;
|
||||||
import '../screens/map/index.dart' as _i4;
|
import '../screens/map/index.dart' as _i3;
|
||||||
import '../screens/student_id/index.dart' as _i2;
|
import '../screens/student_id/index.dart' as _i7;
|
||||||
|
import '../utils/hero_empty_router_page.dart' as _i2;
|
||||||
|
|
||||||
class AppRouter extends _i7.RootStackRouter {
|
class AppRouter extends _i8.RootStackRouter {
|
||||||
AppRouter([_i8.GlobalKey<_i8.NavigatorState>? navigatorKey])
|
AppRouter([_i9.GlobalKey<_i9.NavigatorState>? navigatorKey])
|
||||||
: super(navigatorKey);
|
: super(navigatorKey);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Map<String, _i7.PageFactory> pagesMap = {
|
final Map<String, _i8.PageFactory> pagesMap = {
|
||||||
MainLayout.name: (routeData) {
|
MainLayout.name: (routeData) {
|
||||||
return _i7.MaterialPageX<dynamic>(
|
return _i8.MaterialPageX<dynamic>(
|
||||||
routeData: routeData, child: const _i1.MainLayout());
|
routeData: routeData, child: const _i1.MainLayout());
|
||||||
},
|
},
|
||||||
StudentIdRoute.name: (routeData) {
|
HomePageRouter.name: (routeData) {
|
||||||
return _i7.CustomPage<dynamic>(
|
return _i8.MaterialPageX<dynamic>(
|
||||||
|
routeData: routeData, child: const _i2.HeroEmptyRouterPage());
|
||||||
|
},
|
||||||
|
MapRoute.name: (routeData) {
|
||||||
|
return _i8.MaterialPageX<dynamic>(
|
||||||
|
routeData: routeData, child: const _i3.MapScreen());
|
||||||
|
},
|
||||||
|
EventsRoute.name: (routeData) {
|
||||||
|
return _i8.MaterialPageX<dynamic>(
|
||||||
|
routeData: routeData, child: const _i4.EventsScreen());
|
||||||
|
},
|
||||||
|
InfoRoute.name: (routeData) {
|
||||||
|
return _i8.MaterialPageX<dynamic>(
|
||||||
|
routeData: routeData, child: const _i5.InfoScreen());
|
||||||
|
},
|
||||||
|
HomeRoute.name: (routeData) {
|
||||||
|
return _i8.CustomPage<dynamic>(
|
||||||
routeData: routeData,
|
routeData: routeData,
|
||||||
child: const _i2.StudentIdScreen(),
|
child: const _i6.HomeScreen(),
|
||||||
transitionsBuilder: _i7.TransitionsBuilders.slideTop,
|
transitionsBuilder: _i8.TransitionsBuilders.noTransition,
|
||||||
durationInMilliseconds: 200,
|
|
||||||
opaque: true,
|
opaque: true,
|
||||||
barrierDismissible: false);
|
barrierDismissible: false);
|
||||||
},
|
},
|
||||||
HomeRoute.name: (routeData) {
|
StudentIdRoute.name: (routeData) {
|
||||||
return _i7.MaterialPageX<dynamic>(
|
return _i8.CustomPage<dynamic>(
|
||||||
routeData: routeData, child: const _i3.HomeScreen());
|
routeData: routeData,
|
||||||
},
|
child: const _i7.StudentIdScreen(),
|
||||||
MapRoute.name: (routeData) {
|
transitionsBuilder: _i8.TransitionsBuilders.noTransition,
|
||||||
return _i7.MaterialPageX<dynamic>(
|
opaque: true,
|
||||||
routeData: routeData, child: const _i4.MapScreen());
|
barrierDismissible: false);
|
||||||
},
|
|
||||||
EventsRoute.name: (routeData) {
|
|
||||||
return _i7.MaterialPageX<dynamic>(
|
|
||||||
routeData: routeData, child: const _i5.EventsScreen());
|
|
||||||
},
|
|
||||||
InfoRoute.name: (routeData) {
|
|
||||||
return _i7.MaterialPageX<dynamic>(
|
|
||||||
routeData: routeData, child: const _i6.InfoScreen());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<_i7.RouteConfig> get routes => [
|
List<_i8.RouteConfig> get routes => [
|
||||||
_i7.RouteConfig(MainLayout.name, path: '/', children: [
|
_i8.RouteConfig(MainLayout.name, path: '/', children: [
|
||||||
_i7.RouteConfig(HomeRoute.name,
|
_i8.RouteConfig(HomePageRouter.name,
|
||||||
path: 'home', parent: MainLayout.name),
|
path: 'home',
|
||||||
_i7.RouteConfig(MapRoute.name, path: 'map', parent: MainLayout.name),
|
parent: MainLayout.name,
|
||||||
_i7.RouteConfig(EventsRoute.name,
|
children: [
|
||||||
|
_i8.RouteConfig(HomeRoute.name,
|
||||||
|
path: '', parent: HomePageRouter.name),
|
||||||
|
_i8.RouteConfig(StudentIdRoute.name,
|
||||||
|
path: 'student-id', parent: HomePageRouter.name)
|
||||||
|
]),
|
||||||
|
_i8.RouteConfig(MapRoute.name, path: 'map', parent: MainLayout.name),
|
||||||
|
_i8.RouteConfig(EventsRoute.name,
|
||||||
path: 'events', parent: MainLayout.name),
|
path: 'events', parent: MainLayout.name),
|
||||||
_i7.RouteConfig(InfoRoute.name, path: 'info', parent: MainLayout.name)
|
_i8.RouteConfig(InfoRoute.name, path: 'info', parent: MainLayout.name)
|
||||||
]),
|
])
|
||||||
_i7.RouteConfig(StudentIdRoute.name, path: '/student-id')
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i1.MainLayout]
|
/// [_i1.MainLayout]
|
||||||
class MainLayout extends _i7.PageRouteInfo<void> {
|
class MainLayout extends _i8.PageRouteInfo<void> {
|
||||||
const MainLayout({List<_i7.PageRouteInfo>? children})
|
const MainLayout({List<_i8.PageRouteInfo>? children})
|
||||||
: super(MainLayout.name, path: '/', initialChildren: children);
|
: super(MainLayout.name, path: '/', initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'MainLayout';
|
static const String name = 'MainLayout';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i2.StudentIdScreen]
|
/// [_i2.HeroEmptyRouterPage]
|
||||||
class StudentIdRoute extends _i7.PageRouteInfo<void> {
|
class HomePageRouter extends _i8.PageRouteInfo<void> {
|
||||||
const StudentIdRoute() : super(StudentIdRoute.name, path: '/student-id');
|
const HomePageRouter({List<_i8.PageRouteInfo>? children})
|
||||||
|
: super(HomePageRouter.name, path: 'home', initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'StudentIdRoute';
|
static const String name = 'HomePageRouter';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i3.HomeScreen]
|
/// [_i3.MapScreen]
|
||||||
class HomeRoute extends _i7.PageRouteInfo<void> {
|
class MapRoute extends _i8.PageRouteInfo<void> {
|
||||||
const HomeRoute() : super(HomeRoute.name, path: 'home');
|
|
||||||
|
|
||||||
static const String name = 'HomeRoute';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// generated route for
|
|
||||||
/// [_i4.MapScreen]
|
|
||||||
class MapRoute extends _i7.PageRouteInfo<void> {
|
|
||||||
const MapRoute() : super(MapRoute.name, path: 'map');
|
const MapRoute() : super(MapRoute.name, path: 'map');
|
||||||
|
|
||||||
static const String name = 'MapRoute';
|
static const String name = 'MapRoute';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i5.EventsScreen]
|
/// [_i4.EventsScreen]
|
||||||
class EventsRoute extends _i7.PageRouteInfo<void> {
|
class EventsRoute extends _i8.PageRouteInfo<void> {
|
||||||
const EventsRoute() : super(EventsRoute.name, path: 'events');
|
const EventsRoute() : super(EventsRoute.name, path: 'events');
|
||||||
|
|
||||||
static const String name = 'EventsRoute';
|
static const String name = 'EventsRoute';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i6.InfoScreen]
|
/// [_i5.InfoScreen]
|
||||||
class InfoRoute extends _i7.PageRouteInfo<void> {
|
class InfoRoute extends _i8.PageRouteInfo<void> {
|
||||||
const InfoRoute() : super(InfoRoute.name, path: 'info');
|
const InfoRoute() : super(InfoRoute.name, path: 'info');
|
||||||
|
|
||||||
static const String name = 'InfoRoute';
|
static const String name = 'InfoRoute';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// generated route for
|
||||||
|
/// [_i6.HomeScreen]
|
||||||
|
class HomeRoute extends _i8.PageRouteInfo<void> {
|
||||||
|
const HomeRoute() : super(HomeRoute.name, path: '');
|
||||||
|
|
||||||
|
static const String name = 'HomeRoute';
|
||||||
|
}
|
||||||
|
|
||||||
|
/// generated route for
|
||||||
|
/// [_i7.StudentIdScreen]
|
||||||
|
class StudentIdRoute extends _i8.PageRouteInfo<void> {
|
||||||
|
const StudentIdRoute() : super(StudentIdRoute.name, path: 'student-id');
|
||||||
|
|
||||||
|
static const String name = 'StudentIdRoute';
|
||||||
|
}
|
||||||
|
|
|
@ -9,9 +9,16 @@ import 'package:furman_now/src/widgets/home/restaurants/restaurants_list.dart';
|
||||||
import 'package:furman_now/src/widgets/home/transportation/transportation_card.dart';
|
import 'package:furman_now/src/widgets/home/transportation/transportation_card.dart';
|
||||||
import 'package:furman_now/src/widgets/scroll_view_height.dart';
|
import 'package:furman_now/src/widgets/scroll_view_height.dart';
|
||||||
|
|
||||||
class HomeScreen extends StatelessWidget {
|
class HomeScreen extends StatefulWidget {
|
||||||
const HomeScreen({Key? key}) : super(key: key);
|
const HomeScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<HomeScreen> createState() => _HomeScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HomeScreenState extends State<HomeScreen> {
|
||||||
|
CrossFadeState _showScrollMessage = CrossFadeState.showFirst;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -25,7 +32,7 @@ class HomeScreen extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: 300,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
|
@ -33,7 +40,7 @@ class HomeScreen extends StatelessWidget {
|
||||||
colors: <Color>[
|
colors: <Color>[
|
||||||
Color(0xffb7acc9),
|
Color(0xffb7acc9),
|
||||||
Color(0xffb7acc9),
|
Color(0xffb7acc9),
|
||||||
], // Gradient from https://learnui.design/tools/gradient-generator.html
|
],
|
||||||
tileMode: TileMode.mirror,
|
tileMode: TileMode.mirror,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -47,9 +54,39 @@ class HomeScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("${greeting()},\nMichael", style: furmanTextStyle(const TextStyle(color: Color(0xff26183d), fontSize: 36, fontWeight: FontWeight.w800))),
|
Hero(
|
||||||
|
tag: "title",
|
||||||
|
child: Material(
|
||||||
|
type: MaterialType.transparency,
|
||||||
|
child: Text(
|
||||||
|
"${greeting()},\nMichael",
|
||||||
|
style: furmanTextStyle(const TextStyle(
|
||||||
|
color: Color(0xff26183d),
|
||||||
|
fontSize: 36,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
Text("It's 76º and partly cloudy", style: furmanTextStyle(const TextStyle(color: Color(0xff26183d), fontSize: 16, fontWeight: FontWeight.w500))),
|
AnimatedCrossFade(
|
||||||
|
crossFadeState: _showScrollMessage,
|
||||||
|
duration: const Duration(milliseconds: 100),
|
||||||
|
firstChild: Text("It's 76º and partly cloudy",
|
||||||
|
style: furmanTextStyle(const TextStyle(
|
||||||
|
color: Color(0xff26183d),
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
secondChild: Text("Pull down to view your Meal ID",
|
||||||
|
style: furmanTextStyle(const TextStyle(
|
||||||
|
color: Color(0xff26183d),
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -63,39 +100,63 @@ class HomeScreen extends StatelessWidget {
|
||||||
var offsetAmount = offset.abs();
|
var offsetAmount = offset.abs();
|
||||||
if (offsetAmount > 50) {
|
if (offsetAmount > 50) {
|
||||||
context.router.navigate(const StudentIdRoute());
|
context.router.navigate(const StudentIdRoute());
|
||||||
|
} else if (offsetAmount > 20) {
|
||||||
|
setState(() {
|
||||||
|
_showScrollMessage = CrossFadeState.showSecond;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_showScrollMessage = CrossFadeState.showFirst;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_showScrollMessage != CrossFadeState.showFirst) {
|
||||||
|
setState(() {
|
||||||
|
_showScrollMessage = CrossFadeState.showFirst;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
child: ScrollViewWithHeight(
|
child: ScrollViewWithHeight(
|
||||||
child: Container(
|
child: Hero(
|
||||||
decoration: const BoxDecoration(
|
tag: "card",
|
||||||
color: Colors.white,
|
child: Material(
|
||||||
borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
|
type: MaterialType.transparency,
|
||||||
),
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
decoration: const BoxDecoration(
|
||||||
margin: const EdgeInsets.only(top: 200),
|
color: Colors.white,
|
||||||
width: double.infinity,
|
borderRadius:
|
||||||
child: Column(
|
BorderRadius.vertical(top: Radius.circular(30)),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
const HeaderWidget(
|
|
||||||
title: "Today's Events",
|
|
||||||
link: HeaderLink(text: "View more", href: EventsRoute()),
|
|
||||||
),
|
),
|
||||||
Padding(
|
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
margin: const EdgeInsets.only(top: 200),
|
||||||
child: EventsList(),
|
width: double.infinity,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const HeaderWidget(
|
||||||
|
title: "Today's Events",
|
||||||
|
link: HeaderLink(
|
||||||
|
text: "View more",
|
||||||
|
href: EventsRoute()
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
child: EventsList(),
|
||||||
|
),
|
||||||
|
const HeaderWidget(title: "Food & Dining"),
|
||||||
|
const RestaurantsList(),
|
||||||
|
const HeaderWidget(title: "Transportation"),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
child: TransportationCard(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const HeaderWidget(title: "Food & Dining"),
|
),
|
||||||
const RestaurantsList(),
|
|
||||||
const HeaderWidget(title: "Transportation"),
|
|
||||||
const Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
|
||||||
child: TransportationCard(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:furman_now/src/services/events/event.dart';
|
||||||
|
import 'package:furman_now/src/services/events/events_service.dart';
|
||||||
|
import 'package:furman_now/src/services/restaurants/restaurant_service.dart';
|
||||||
|
|
||||||
|
class AppState extends ChangeNotifier {
|
||||||
|
late Future<List<Event>> events;
|
||||||
|
late Future<List<Restaurant>> restaurants;
|
||||||
|
|
||||||
|
AppState() {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void refresh() {
|
||||||
|
events = EventsService.fetchEvents();
|
||||||
|
restaurants = RestaurantService.fetchRestaurants();
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
events.hashCode ^
|
||||||
|
restaurants.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is AppState &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
events == other.events &&
|
||||||
|
restaurants == other.restaurants;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class HeroEmptyRouterPage extends StatelessWidget {
|
||||||
|
const HeroEmptyRouterPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return HeroControllerScope(
|
||||||
|
controller: HeroController(),
|
||||||
|
child: const AutoRouter(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:furman_now/src/services/events/event.dart';
|
import 'package:furman_now/src/services/events/event.dart';
|
||||||
import 'package:furman_now/src/services/events/events_service.dart';
|
import 'package:furman_now/src/store/index.dart';
|
||||||
import 'package:furman_now/src/utils/theme.dart';
|
import 'package:furman_now/src/utils/theme.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'event_card.dart';
|
import 'event_card.dart';
|
||||||
|
|
||||||
|
@ -34,62 +35,61 @@ class EventsList extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _EventsListState extends State<EventsList> {
|
class _EventsListState extends State<EventsList> {
|
||||||
late Future<Iterable<Event>> futureEventList;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
futureEventList = EventsService.fetchEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return FutureBuilder<Iterable<Event>>(
|
return Consumer<AppState>(
|
||||||
future: futureEventList,
|
builder: (context, state, child) {
|
||||||
builder: (context, snapshot) {
|
return FutureBuilder<Iterable<Event>>(
|
||||||
if (snapshot.hasData) {
|
future: state.events,
|
||||||
var events = snapshot.data!.where((event) {
|
builder: (context, snapshot) {
|
||||||
return event.time.isAfter(widget.dateRange.start) && event.time.isBefore(widget.dateRange.end);
|
if (snapshot.hasData) {
|
||||||
});
|
var events = snapshot.data!.where((event) {
|
||||||
if (events.isNotEmpty) {
|
return event.time.isAfter(widget.dateRange.start) &&
|
||||||
return Column(
|
event.time.isBefore(widget.dateRange.end);
|
||||||
children: events.map((event) {
|
});
|
||||||
return Padding(
|
if (events.isNotEmpty) {
|
||||||
padding: const EdgeInsets.only(bottom: 15),
|
return Column(
|
||||||
child: EventCard(event),
|
children: events.map((event) {
|
||||||
);
|
return Padding(
|
||||||
}).toList());
|
padding: const EdgeInsets.only(bottom: 15),
|
||||||
} else {
|
child: EventCard(event),
|
||||||
return Padding(
|
);
|
||||||
padding: const EdgeInsets.only(bottom: 15),
|
}).toList());
|
||||||
child: SizedBox(
|
} else {
|
||||||
width: double.infinity,
|
return Padding(
|
||||||
height: 50,
|
padding: const EdgeInsets.only(bottom: 15),
|
||||||
child: Center(
|
child: SizedBox(
|
||||||
child: Text(
|
width: double.infinity,
|
||||||
"No events today :(",
|
height: 50,
|
||||||
style: furmanTextStyle(TextStyle(
|
child: Center(
|
||||||
color: Colors.grey[600],
|
child: Text(
|
||||||
fontSize: 16,
|
"No events today :(",
|
||||||
fontWeight: FontWeight.w600,
|
style: furmanTextStyle(TextStyle(
|
||||||
)),
|
color: Colors.grey[600],
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
}
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Text(
|
||||||
|
'${snapshot.error}', style: const TextStyle(color: Colors.red),);
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default, show a loading spinner.
|
||||||
|
return const Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 25),
|
||||||
|
child: CircularProgressIndicator()
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
} else if (snapshot.hasError) {
|
|
||||||
return Text('${snapshot.error}', style: const TextStyle(color: Colors.red),);
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default, show a loading spinner.
|
|
||||||
return const Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 25),
|
|
||||||
child: CircularProgressIndicator()
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:furman_now/src/services/restaurants/restaurant_service.dart';
|
import 'package:furman_now/src/services/restaurants/restaurant_service.dart';
|
||||||
|
import 'package:furman_now/src/store/index.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'restaurant_card.dart';
|
import 'restaurant_card.dart';
|
||||||
|
|
||||||
|
@ -11,51 +13,47 @@ class RestaurantsList extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RestaurantsListState extends State<RestaurantsList> {
|
class _RestaurantsListState extends State<RestaurantsList> {
|
||||||
late Future<List<Restaurant>> futureEventList;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
futureEventList = RestaurantService.fetchRestaurants();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return FutureBuilder<List<Restaurant>>(
|
return Consumer<AppState>(
|
||||||
future: futureEventList,
|
builder: (context, state, child) {
|
||||||
builder: (context, snapshot) {
|
return FutureBuilder<List<Restaurant>>(
|
||||||
if (snapshot.hasData) {
|
future: state.restaurants,
|
||||||
var restaurants = snapshot.data!..sort((r1, r2) => (r1.isOpen ? 0 : 1) - (r2.isOpen ? 0 : 1));
|
builder: (context, snapshot) {
|
||||||
return SizedBox(
|
if (snapshot.hasData) {
|
||||||
height: 175,
|
var restaurants = snapshot.data!..sort((r1, r2) => (r1.isOpen ? 0 : 1) - (r2.isOpen ? 0 : 1));
|
||||||
child: ListView.builder(
|
return SizedBox(
|
||||||
padding: const EdgeInsets.only(left: 20),
|
height: 175,
|
||||||
itemCount: restaurants.length,
|
child: ListView.builder(
|
||||||
cacheExtent: 10000,
|
padding: const EdgeInsets.only(left: 20),
|
||||||
scrollDirection: Axis.horizontal,
|
itemCount: restaurants.length,
|
||||||
prototypeItem: Padding(
|
cacheExtent: 10000,
|
||||||
padding: const EdgeInsets.only(right: 15),
|
scrollDirection: Axis.horizontal,
|
||||||
child: RestaurantCard(restaurant: restaurants.first),
|
prototypeItem: Padding(
|
||||||
),
|
padding: const EdgeInsets.only(right: 15),
|
||||||
itemBuilder: (context, index) => Padding(
|
child: RestaurantCard(restaurant: restaurants.first),
|
||||||
padding: const EdgeInsets.only(right: 15),
|
),
|
||||||
child: RestaurantCard(restaurant: restaurants[index]),
|
itemBuilder: (context, index) => Padding(
|
||||||
),
|
padding: const EdgeInsets.only(right: 15),
|
||||||
),
|
child: RestaurantCard(restaurant: restaurants[index]),
|
||||||
);
|
),
|
||||||
} else if (snapshot.hasError) {
|
),
|
||||||
return Padding(
|
);
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
} else if (snapshot.hasError) {
|
||||||
child: Text('${snapshot.error}', style: const TextStyle(color: Colors.red))
|
return Padding(
|
||||||
);
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
}
|
child: Text('${snapshot.error}', style: const TextStyle(color: Colors.red))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// By default, show a loading spinner.
|
// By default, show a loading spinner.
|
||||||
return const Center(
|
return const Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 25),
|
padding: EdgeInsets.symmetric(vertical: 25),
|
||||||
child: CircularProgressIndicator()
|
child: CircularProgressIndicator()
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
35
pubspec.lock
35
pubspec.lock
|
@ -265,6 +265,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.4"
|
version: "4.1.4"
|
||||||
|
flutter_remix:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_remix
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.3"
|
||||||
flutter_svg:
|
flutter_svg:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -422,6 +429,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "1.0.1"
|
||||||
|
local_hero:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: local_hero
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.0"
|
||||||
logging:
|
logging:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -464,6 +478,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "1.0.2"
|
||||||
|
nested:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: nested
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
node_preamble:
|
node_preamble:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -611,6 +632,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.0"
|
||||||
|
provider:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: provider
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "6.0.3"
|
||||||
pub_semver:
|
pub_semver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -639,6 +667,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.0"
|
||||||
|
salomon_bottom_bar:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: salomon_bottom_bar
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.3.1"
|
||||||
shelf:
|
shelf:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -47,6 +47,9 @@ dependencies:
|
||||||
flutter_svg: ^1.1.4
|
flutter_svg: ^1.1.4
|
||||||
auto_route: ^5.0.1
|
auto_route: ^5.0.1
|
||||||
flutter_map_location_marker: ^4.1.4
|
flutter_map_location_marker: ^4.1.4
|
||||||
|
salomon_bottom_bar: ^3.3.1
|
||||||
|
flutter_remix: ^0.0.3
|
||||||
|
provider: ^6.0.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Reference in New Issue