From 83d3a1a1f15f9f77106ec6c1c8e3a902202ce753 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Sun, 26 Feb 2023 14:52:49 -0500 Subject: [PATCH 1/2] theming stuff --- lib/auth_gate.dart | 2 +- lib/main.dart | 44 ++++++++++++--- macos/Flutter/GeneratedPluginRegistrant.swift | 2 - pubspec.lock | 56 ------------------- pubspec.yaml | 2 - .../flutter/generated_plugin_registrant.cc | 3 - windows/flutter/generated_plugins.cmake | 1 - 7 files changed, 37 insertions(+), 73 deletions(-) diff --git a/lib/auth_gate.dart b/lib/auth_gate.dart index 1897ce5..97a2978 100644 --- a/lib/auth_gate.dart +++ b/lib/auth_gate.dart @@ -25,7 +25,7 @@ class AuthGate extends StatelessWidget { stream: FirebaseAuth.instance.authStateChanges(), builder: (context, snapshot) { if (!snapshot.hasData) { - return SignInScreen( + return SignInScreen( providerConfigs: const [ EmailProviderConfiguration(), ], diff --git a/lib/main.dart b/lib/main.dart index fbb9a37..e5c7b8b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,8 +9,7 @@ import 'auth_gate.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); - Stripe.publishableKey = - "pk_test_51MfY7PFVdcWv896FKvDhgKabYeDq4AnoFcWxCAg4hquj6TBAsN0kznXPVyKA7M1pMq5PsieGQwsx6QY5ld5ZQzJ500rVCMPPXp"; + Stripe.publishableKey = "pk_test_51MfY7PFVdcWv896FKvDhgKabYeDq4AnoFcWxCAg4hquj6TBAsN0kznXPVyKA7M1pMq5PsieGQwsx6QY5ld5ZQzJ500rVCMPPXp"; runApp(const MyApp()); } @@ -21,6 +20,39 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( theme: ThemeData( + inputDecorationTheme: InputDecorationTheme( + fillColor: Color.fromARGB(255, 40, 40, 40), + filled: true, + outlineBorder: BorderSide( + color: Colors.white, + ), + labelStyle: TextStyle( + color: Color.fromARGB(255, 205, 0, 48), + ), + focusColor: Colors.white, + hintStyle: TextStyle( + color: Color.fromARGB(255, 205, 0, 48), + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + textSelectionTheme: TextSelectionThemeData(), + fixTextFieldOutlineLabel: true, + outlinedButtonTheme: OutlinedButtonThemeData( + style: ButtonStyle( + padding: MaterialStateProperty.all( + const EdgeInsets.all(24), + ), + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + backgroundColor: MaterialStateProperty.all(Color.fromARGB(255, 205, 0, 48)), + foregroundColor: MaterialStateProperty.all(Colors.white), + ), + ), primarySwatch: CustomMaterialColor(205, 0, 48).mdColor, scaffoldBackgroundColor: Colors.black87, fontFamily: GoogleFonts.figtree().fontFamily, @@ -28,13 +60,9 @@ class MyApp extends StatelessWidget { bodyColor: CustomMaterialColor(240, 240, 240).mdColor, displayColor: CustomMaterialColor(240, 240, 240).mdColor, ), - textButtonTheme: TextButtonThemeData( - style: ButtonStyle( - textStyle: MaterialStatePropertyAll(TextStyle( - color: CustomMaterialColor(240, 240, 240).mdColor)))), + textButtonTheme: TextButtonThemeData(style: ButtonStyle(textStyle: MaterialStatePropertyAll(TextStyle(color: CustomMaterialColor(240, 240, 240).mdColor)))), checkboxTheme: CheckboxThemeData( - fillColor: MaterialStatePropertyAll( - CustomMaterialColor(240, 240, 240).mdColor), + fillColor: MaterialStatePropertyAll(CustomMaterialColor(240, 240, 240).mdColor), checkColor: MaterialStatePropertyAll(Colors.black), ), ), diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index f9fe25e..936be3a 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,7 +10,6 @@ import desktop_webview_auth import firebase_auth import firebase_core import firebase_database -import geolocator_apple import path_provider_foundation import sign_in_with_apple import twitter_login @@ -21,7 +20,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseDatabasePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseDatabasePlugin")) - GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin")) TwitterLoginPlugin.register(with: registry.registrar(forPlugin: "TwitterLoginPlugin")) diff --git a/pubspec.lock b/pubspec.lock index cfd0664..0eced40 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -262,14 +262,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" - flutter_dotenv: - dependency: "direct main" - description: - name: flutter_dotenv - sha256: d9283d92059a22e9834bc0a31336658ffba77089fb6f3cc36751f1fc7c6661a3 - url: "https://pub.dev" - source: hosted - version: "5.0.2" flutter_facebook_auth: dependency: transitive description: @@ -349,54 +341,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.0" - geolocator: - dependency: "direct main" - description: - name: geolocator - sha256: "5c23f3613f50586c0bbb2b8f970240ae66b3bd992088cf60dd5ee2e6f7dde3a8" - url: "https://pub.dev" - source: hosted - version: "9.0.2" - geolocator_android: - dependency: transitive - description: - name: geolocator_android - sha256: "2ba24690aee0a3e1b6b7bd47c2711a50c874e95e4c758346589d35194adf6d6a" - url: "https://pub.dev" - source: hosted - version: "4.1.7" - geolocator_apple: - dependency: transitive - description: - name: geolocator_apple - sha256: "22b60ca3b8c0f58e6a9688ff855ee39ab813ca3f0c0609a48d282f6631266f2e" - url: "https://pub.dev" - source: hosted - version: "2.2.5" - geolocator_platform_interface: - dependency: transitive - description: - name: geolocator_platform_interface - sha256: af4d69231452f9620718588f41acc4cb58312368716bfff2e92e770b46ce6386 - url: "https://pub.dev" - source: hosted - version: "4.0.7" - geolocator_web: - dependency: transitive - description: - name: geolocator_web - sha256: f68a122da48fcfff68bbc9846bb0b74ef651afe84a1b1f6ec20939de4d6860e1 - url: "https://pub.dev" - source: hosted - version: "2.1.6" - geolocator_windows: - dependency: transitive - description: - name: geolocator_windows - sha256: f5911c88e23f48b598dd506c7c19eff0e001645bdc03bb6fecb9f4549208354d - url: "https://pub.dev" - source: hosted - version: "0.1.1" google_fonts: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 9958fd9..9746233 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,9 +38,7 @@ dependencies: firebase_core: ^2.7.0 firebase_auth: ^4.2.9 flutterfire_ui: ^0.4.3+20 - flutter_dotenv: ^5.0.2 persistent_bottom_nav_bar: any - geolocator: ^9.0.2 flutter_credit_card: any flutter_stripe: any material_dialogs: any diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 75e23e2..45e2647 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,11 +7,8 @@ #include "generated_plugin_registrant.h" #include -#include void RegisterPlugins(flutter::PluginRegistry* registry) { DesktopWebviewAuthPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("DesktopWebviewAuthPlugin")); - GeolocatorWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("GeolocatorWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 3ff9bdc..6797231 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,7 +4,6 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_webview_auth - geolocator_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST From 06de1254863accd2083916426f853a15f51f2fd7 Mon Sep 17 00:00:00 2001 From: Ashish Bailkeri Date: Sun, 26 Feb 2023 15:27:51 -0500 Subject: [PATCH 2/2] holy fuck its future --- lib/buy.dart | 325 +++++++++++++++++++++++++++++---------------------- 1 file changed, 186 insertions(+), 139 deletions(-) diff --git a/lib/buy.dart b/lib/buy.dart index 883fb04..6873fbc 100644 --- a/lib/buy.dart +++ b/lib/buy.dart @@ -2,6 +2,9 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:ruswipeshare/main.dart'; +import 'package:intl/intl.dart'; + +import 'meetings.dart'; enum CampusState { campuses, list_options, offers } @@ -64,6 +67,8 @@ class BuyScreen extends StatefulWidget { class _BuyScreenState extends State { CampusState _currentState = CampusState.campuses; List _diningOptions = List.empty(); + List _sellersAtDiningHall = []; + String _selectedLocation = ""; @override Widget build(BuildContext context) { @@ -348,157 +353,199 @@ class _BuyScreenState extends State { itemCount: 30, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), itemBuilder: (BuildContext context, int index) { - return InkWell( - onTap: () { - showSheet(context, index); - // showDialog( - // context: context, - // builder: (BuildContext context) => Dialog( - // backgroundColor: Theme.of(context).scaffoldBackgroundColor, - // shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20))), - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // child: Column( - // mainAxisSize: MainAxisSize.min, - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // const Text('Transaction Details'), - // const SizedBox(height: 15), - // TextButton( - // onPressed: () { - // Navigator.pop(context); - // }, - // child: const Text('Close'), - // ), - // ], - // ), - // ))); - // // Dialogs.materialDialog( - // // color: Theme.of(context).scaffoldBackgroundColor, - // // customView: const TransactionDetails(), - // // customViewPosition: - // // CustomViewPosition.BEFORE_ACTION, - // // msgAlign: TextAlign.center, - // // msg: - // // 'Please read all the information below before purchasing.\n', - // // title: 'Transaction Details', - // // context: context, - // // actions: [ - // // IconsOutlineButton( - // // onPressed: () {}, - // // text: 'Cancel', - // // iconData: Icons.cancel_outlined, - // // color: Theme.of(context).primaryColor, - // // textStyle: TextStyle( - // // color: CustomMaterialColor(240, 240, 240) - // // .mdColor, - // // ), - // // iconColor: CustomMaterialColor(240, 240, 240) - // // .mdColor), - // // IconsButton( - // // onPressed: () {}, - // // text: 'Purchase', - // // iconData: Icons.done, - // // color: Colors.green, - // // textStyle: TextStyle( - // // color: CustomMaterialColor(240, 240, 240) - // // .mdColor, - // // ), - // // iconColor: CustomMaterialColor(240, 240, 240) - // // .mdColor), - // // ], - // // ); - }, - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: CustomMaterialColor(240, 240, 240) - .mdColor, - width: 2), - borderRadius: - const BorderRadius.all(Radius.circular(10))), - margin: const EdgeInsets.all(4), - height: 120, - child: ClipRRect( - borderRadius: - const BorderRadius.all(Radius.circular(10)), - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - colorFilter: const ColorFilter.mode( - Colors.black26, BlendMode.darken), - fit: BoxFit.cover, - image: AssetImage(timeBgAssets[index % 3]), - )), - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 2, sigmaY: 2), - child: Row( - children: [ - Expanded( - flex: 7, - child: Container( - padding: EdgeInsets.only(left: 20), - // color: Colors.red, - margin: const EdgeInsets.only( - top: 4, left: 4, bottom: 4), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - entries[index % entries.length], - textAlign: TextAlign.start, - overflow: TextOverflow.ellipsis, - style: - const TextStyle(fontSize: 20), - ), - Row( - children: const [ - Icon(Icons.star, size: 16), - Icon(Icons.star, size: 16), - Icon(Icons.star, size: 16), - Icon(Icons.star_half, size: 16), - Icon(Icons.star_border, - size: 16), - ], - ), - Expanded( + List sellers = []; + var loc = _diningOptions[index % _diningOptions.length]; + + return FutureBuilder>( + future: getSellers(Filter([loc], null, null)), + builder: (BuildContext context, + AsyncSnapshot> snapshot) { + if (snapshot.hasData) { + final data = snapshot.data ?? []; + String startTimeFmt = DateFormat("h:mm a").format( + data[index % data.length] + .availableTime + .startTime + .toDate()); + + String endTimeFmt = DateFormat("h:mm a").format( + data[index % data.length] + .availableTime + .endTime + .toDate()); + + final price = data[index % data.length].price; + + return InkWell( + onTap: () { + showSheet(context, index); + // showDialog( + // context: context, + // builder: (BuildContext context) => Dialog( + // backgroundColor: Theme.of(context).scaffoldBackgroundColor, + // shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20))), + // child: Padding( + // padding: const EdgeInsets.all(8.0), + // child: Column( + // mainAxisSize: MainAxisSize.min, + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // const Text('Transaction Details'), + // const SizedBox(height: 15), + // TextButton( + // onPressed: () { + // Navigator.pop(context); + // }, + // child: const Text('Close'), + // ), + // ], + // ), + // ))); + // // Dialogs.materialDialog( + // // color: Theme.of(context).scaffoldBackgroundColor, + // // customView: const TransactionDetails(), + // // customViewPosition: + // // CustomViewPosition.BEFORE_ACTION, + // // msgAlign: TextAlign.center, + // // msg: + // // 'Please read all the information below before purchasing.\n', + // // title: 'Transaction Details', + // // context: context, + // // actions: [ + // // IconsOutlineButton( + // // onPressed: () {}, + // // text: 'Cancel', + // // iconData: Icons.cancel_outlined, + // // color: Theme.of(context).primaryColor, + // // textStyle: TextStyle( + // // color: CustomMaterialColor(240, 240, 240) + // // .mdColor, + // // ), + // // iconColor: CustomMaterialColor(240, 240, 240) + // // .mdColor), + // // IconsButton( + // // onPressed: () {}, + // // text: 'Purchase', + // // iconData: Icons.done, + // // color: Colors.green, + // // textStyle: TextStyle( + // // color: CustomMaterialColor(240, 240, 240) + // // .mdColor, + // // ), + // // iconColor: CustomMaterialColor(240, 240, 240) + // // .mdColor), + // // ], + // // ); + }, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: + CustomMaterialColor(240, 240, 240) + .mdColor, + width: 2), + borderRadius: const BorderRadius.all( + Radius.circular(10))), + margin: const EdgeInsets.all(4), + height: 120, + child: ClipRRect( + borderRadius: const BorderRadius.all( + Radius.circular(10)), + child: Container( + decoration: BoxDecoration( + image: DecorationImage( + colorFilter: const ColorFilter.mode( + Colors.black26, BlendMode.darken), + fit: BoxFit.cover, + image: + AssetImage(timeBgAssets[index % 3]), + )), + child: BackdropFilter( + filter: ImageFilter.blur( + sigmaX: 2, sigmaY: 2), + child: Row( + children: [ + Expanded( + flex: 7, + child: Container( + padding: + EdgeInsets.only(left: 20), + // color: Colors.red, + margin: const EdgeInsets.only( + top: 4, left: 4, bottom: 4), child: Column( - mainAxisAlignment: - MainAxisAlignment.end, - children: const [ + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ Text( - '88:88PM - 88:88PM', + data?[index % data.length] + .name ?? + "Unknown Seller", textAlign: TextAlign.start, overflow: TextOverflow.ellipsis, - style: - TextStyle(fontSize: 16), + style: const TextStyle( + fontSize: 20), ), + Row( + children: const [ + Icon(Icons.star, + size: 16), + Icon(Icons.star, + size: 16), + Icon(Icons.star, + size: 16), + Icon(Icons.star_half, + size: 16), + Icon(Icons.star_border, + size: 16), + ], + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Text( + "$startTimeFmt - $endTimeFmt", + textAlign: + TextAlign.start, + overflow: TextOverflow + .ellipsis, + style: TextStyle( + fontSize: 16), + ), + ], + ), + ) ], ), - ) - ], - ), + ), + ), + Expanded( + flex: 3, + child: Container( + padding: + EdgeInsets.only(right: 15), + child: Text( + '\$${price}', + textAlign: TextAlign.end, + style: TextStyle(fontSize: 44), + ), + ), + ), + ], ), ), - Expanded( - flex: 3, - child: Container( - padding: EdgeInsets.only(right: 15), - child: Text( - '\$88', - textAlign: TextAlign.end, - style: TextStyle(fontSize: 44), - ), - ), - ), - ], + ), ), ), - ), - ), - ), + ); + } else if (snapshot.hasError) { + return Text("${snapshot.error}"); + } + return CircularProgressIndicator(); + }, ); }), ),