repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/flutter_firebase_starter/lib/features/auth/data
mirrored_repositories/flutter_firebase_starter/lib/features/auth/data/model/user_repository.dart
import 'dart:async'; import 'dart:io'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:device_info/device_info.dart'; import 'package:flutter/widgets.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:google_sign_in/google_sign_in.dart'; import 'package:package_info/package_info.dart'; import 'package:firebasestarter/core/data/res/data_constants.dart'; import 'package:firebasestarter/features/notification/data/service/push_notification_service.dart'; import 'package:firebasestarter/features/profile/data/model/device.dart'; import 'package:firebasestarter/features/profile/data/model/device_field.dart'; import 'package:firebasestarter/features/profile/data/model/user.dart'; import 'package:firebasestarter/features/profile/data/model/user_field.dart'; import 'package:firebasestarter/features/profile/data/service/user_db_service.dart'; enum Status { Uninitialized, Authenticated, Authenticating, Unauthenticated } class UserRepository with ChangeNotifier { FirebaseAuth _auth; User _user; GoogleSignIn _googleSignIn; Status _status = Status.Uninitialized; String _error; StreamSubscription _userListener; UserModel _fsUser; Device currentDevice; final PushNotificationService pnService; bool _loading; UserRepository.instance(this.pnService) : _auth = FirebaseAuth.instance, _googleSignIn = GoogleSignIn(scopes: ['email']) { _error = ''; _loading = true; _auth.authStateChanges().listen(_onAuthStateChanged); } String get error => _error; Status get status => _status; User get fbUser => _user; UserModel get user => _fsUser; bool get isLoading => _loading; Future<bool> signIn(String email, String password) async { try { _status = Status.Authenticating; notifyListeners(); await _auth.signInWithEmailAndPassword(email: email, password: password); _error = ''; return true; } catch (e) { _error = e.message; _status = Status.Unauthenticated; notifyListeners(); return false; } } Future<bool> signup(String email, String password) async { try { _status = Status.Authenticating; notifyListeners(); await _auth.createUserWithEmailAndPassword( email: email, password: password); _error = ''; return true; } catch (e) { _error = e.message; _status = Status.Unauthenticated; notifyListeners(); return false; } } Future<bool> signInWithGoogle() async { try { _status = Status.Authenticating; notifyListeners(); final GoogleSignInAccount googleUser = await _googleSignIn.signIn(); final GoogleSignInAuthentication googleAuth = await googleUser.authentication; final GoogleAuthCredential credential = GoogleAuthProvider.credential( accessToken: googleAuth.accessToken, idToken: googleAuth.idToken, ); await _auth.signInWithCredential(credential); _error = ''; return true; } catch (e) { _error = e.message; _status = Status.Unauthenticated; notifyListeners(); return false; } } Future signOut() async { _auth.signOut(); _googleSignIn.signOut(); _status = Status.Unauthenticated; _fsUser = null; _userListener.cancel(); notifyListeners(); return Future.delayed(Duration.zero); } Future<void> _onAuthStateChanged(User firebaseUser) async { if (firebaseUser == null) { _status = Status.Unauthenticated; _fsUser = null; _user = null; } else { _user = firebaseUser; _saveUserRecord(); _userListener = userDBS.streamSingle(_user.uid).listen((user) { _fsUser = user; _loading = false; notifyListeners(); }); _status = Status.Authenticated; } notifyListeners(); } Future<void> _saveUserRecord() async { if (_user == null) return; PackageInfo packageInfo = await PackageInfo.fromPlatform(); int buildNumber = int.parse(packageInfo.buildNumber); UserModel user = UserModel( email: _user.email, name: _user.displayName, photoUrl: _user.photoURL, id: _user.uid, registrationDate: DateTime.now().toUtc(), lastLoggedIn: DateTime.now().toUtc(), buildNumber: buildNumber, introSeen: false, ); UserModel existing = await userDBS.getSingle(_user.uid); if (existing == null) { await userDBS.createItem(user, id: _user.uid); _fsUser = user; } else { await userDBS.updateData(_user.uid, { UserFields.lastLoggedIn: FieldValue.serverTimestamp(), UserFields.buildNumber: buildNumber, }); } _saveDevice(user); } Future<void> _saveDevice(UserModel user) async { DeviceInfoPlugin devicePlugin = DeviceInfoPlugin(); String deviceId; DeviceDetails deviceDescription; if (Platform.isAndroid) { AndroidDeviceInfo deviceInfo = await devicePlugin.androidInfo; deviceId = deviceInfo.androidId; deviceDescription = DeviceDetails( device: deviceInfo.device, model: deviceInfo.model, osVersion: deviceInfo.version.sdkInt.toString(), platform: 'android', ); } if (Platform.isIOS) { IosDeviceInfo deviceInfo = await devicePlugin.iosInfo; deviceId = deviceInfo.identifierForVendor; deviceDescription = DeviceDetails( osVersion: deviceInfo.systemVersion, device: deviceInfo.name, model: deviceInfo.utsname.machine, platform: 'ios', ); } PackageInfo packageInfo = await PackageInfo.fromPlatform(); int buildNumber = int.parse(packageInfo.buildNumber); final nowMS = DateTime.now().toUtc().millisecondsSinceEpoch; if (user.buildNumber != buildNumber) { userDBS.updateData(user.id, { UserFields.buildNumber: buildNumber, UserFields.lastUpdated: nowMS, }); } userDeviceDBS.collection = "${AppDBConstants.usersCollection}/${user.id}/devices"; Device exsiting = await userDeviceDBS.getSingle(deviceId); if (exsiting != null) { var token = exsiting.token ?? await pnService.init(); await userDeviceDBS.updateData(deviceId, { DeviceFields.lastUpdatedAt: nowMS, DeviceFields.expired: false, DeviceFields.uninstalled: false, DeviceFields.token: token, }); currentDevice = exsiting; } else { var token = await pnService.init(); Device device = Device( createdAt: DateTime.now().toUtc(), deviceInfo: deviceDescription, token: token, expired: false, id: deviceId, lastUpdatedAt: nowMS, uninstalled: false, ); await userDeviceDBS.createItem(device, id: deviceId); currentDevice = device; } notifyListeners(); } @override void dispose() { _userListener.cancel(); super.dispose(); } }
0
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation/widgets/auth_dialog.dart
import 'package:flutter/material.dart'; import './login.dart'; import './signup.dart'; class AuthDialog extends StatefulWidget { final int selectedTab; final Function onClose; const AuthDialog({Key key, this.selectedTab, this.onClose}) : super(key: key); @override _AuthDialogState createState() => _AuthDialogState(); } class _AuthDialogState extends State<AuthDialog> { int _selectedTab; @override void initState() { super.initState(); _selectedTab = widget.selectedTab ?? 0; } @override Widget build(BuildContext context) { return Center( child: DefaultTabController( initialIndex: _selectedTab, length: 2, child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ Row( children: <Widget>[ Expanded( child: TabBar( onTap: (index) { setState(() { _selectedTab = index; }); }, indicator: BoxDecoration( borderRadius: BorderRadius.circular(50), color: Theme.of(context).primaryColor, ), tabs: <Widget>[ Tab( text: "Login", ), Tab( text: "Signup", ) ], ), ), IconButton( color: Colors.white, icon: Icon(Icons.clear), onPressed: () => widget.onClose != null ? widget.onClose() : Navigator.pop(context), ), ], ), const SizedBox(height: 10.0), Container( padding: const EdgeInsets.all(0), color: Colors.grey.shade200, height: 300, child: AnimatedSwitcher( duration: Duration(milliseconds: 300), child: _selectedTab == 0 ? LoginForm() : SignupForm(), ), ), ], ), ), ); } }
0
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation/widgets/login.dart
import 'package:flutter/material.dart'; import 'package:firebasestarter/generated/l10n.dart'; import '../../data/model/user_repository.dart'; import 'package:provider/provider.dart'; class LoginForm extends StatefulWidget { @override _LoginFormState createState() => _LoginFormState(); } class _LoginFormState extends State<LoginForm> { TextStyle style = TextStyle(fontSize: 20.0); TextEditingController _email; TextEditingController _password; FocusNode _passwordField; final _formKey = GlobalKey<FormState>(); UserRepository user; @override void initState() { super.initState(); _email = TextEditingController(text: ""); _password = TextEditingController(text: ""); _passwordField = FocusNode(); } @override Widget build(BuildContext context) { user = Provider.of<UserRepository>(context); return Form( key: _formKey, child: ListView( padding: const EdgeInsets.all(16.0), children: <Widget>[ Container( padding: const EdgeInsets.all(0), child: TextFormField( key: Key("email-field"), controller: _email, validator: (value) => (value.isEmpty) ? S.of(context).emailValidationError : null, decoration: InputDecoration( labelText: S.of(context).emailFieldlabel, ), style: style, textInputAction: TextInputAction.next, onEditingComplete: () { FocusScope.of(context).requestFocus(_passwordField); }, ), ), const SizedBox(height: 10.0), Container( padding: const EdgeInsets.all(0), child: TextFormField( focusNode: _passwordField, key: Key("password-field"), controller: _password, obscureText: true, validator: (value) => (value.isEmpty) ? S.of(context).passwordValidationError : null, decoration: InputDecoration( labelText: S.of(context).passwordFieldLabel, ), style: style, onEditingComplete: _login, ), ), SizedBox(height: 10.0), if (user.status == Status.Authenticating) Center(child: CircularProgressIndicator()), if (user.status != Status.Authenticating) Center( child: RaisedButton( key: Key("login-button"), elevation: 0, highlightElevation: 0, onPressed: _login, child: Text(S.of(context).loginButtonText), ), ), ], ), ); } _login() async { if (_formKey.currentState.validate()) { if (!await user.signIn(_email.text, _password.text)) Scaffold.of(context).showSnackBar(SnackBar( content: Text(user.error), )); } } @override void dispose() { _email.dispose(); _password.dispose(); super.dispose(); } }
0
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation/widgets/signup.dart
import 'package:flutter/material.dart'; import 'package:firebasestarter/generated/l10n.dart'; import '../../data/model/user_repository.dart'; import 'package:provider/provider.dart'; class SignupForm extends StatefulWidget { @override _SignupFormState createState() => _SignupFormState(); } class _SignupFormState extends State<SignupForm> { TextStyle style = TextStyle(fontSize: 20.0); TextEditingController _email; TextEditingController _password; TextEditingController _confirmPassword; FocusNode _passwordField; FocusNode _confirmPasswordField; final _formKey = GlobalKey<FormState>(); final _key = GlobalKey<ScaffoldState>(); UserRepository user; @override void initState() { super.initState(); _email = TextEditingController(text: ""); _password = TextEditingController(text: ""); _confirmPassword = TextEditingController(text: ""); _passwordField = FocusNode(); _confirmPasswordField = FocusNode(); } @override Widget build(BuildContext context) { user = Provider.of<UserRepository>(context); return Form( key: _formKey, child: ListView( padding: const EdgeInsets.all(16.0), children: <Widget>[ Container( padding: const EdgeInsets.all(0), child: TextFormField( key: Key("email-field"), controller: _email, validator: (value) => (value.isEmpty) ? S.of(context).emailValidationError : null, decoration: InputDecoration( labelText: S.of(context).emailFieldlabel, ), style: style, textInputAction: TextInputAction.next, onEditingComplete: () { FocusScope.of(context).requestFocus(_passwordField); }, ), ), const SizedBox(height: 10.0), Container( padding: const EdgeInsets.all(0), child: TextFormField( focusNode: _passwordField, key: Key("password-field"), controller: _password, obscureText: true, validator: (value) => (value.isEmpty) ? S.of(context).passwordValidationError : null, decoration: InputDecoration( labelText: S.of(context).passwordValidationError, ), style: style, textInputAction: TextInputAction.next, onEditingComplete: () { FocusScope.of(context).requestFocus(_confirmPasswordField); }, ), ), const SizedBox(height: 10.0), Container( padding: const EdgeInsets.all(0), child: TextFormField( key: Key("confirm-password-field"), controller: _confirmPassword, obscureText: true, validator: (value) => (value.isEmpty) ? S.of(context).confirmPasswordValidationEmptyError : value.isNotEmpty && _password.text != _confirmPassword.text ? S.of(context).confirmPasswordValidationMatchError : null, decoration: InputDecoration( labelText: S.of(context).confirmPasswordFieldLabel, ), style: style, focusNode: _confirmPasswordField, onEditingComplete: () => _signup(), ), ), SizedBox(height: 10.0), if (user.status == Status.Authenticating) Center(child: CircularProgressIndicator()), if (user.status != Status.Authenticating) Center( child: RaisedButton( elevation: 0, highlightElevation: 0, onPressed: _signup, child: Text(S.of(context).signupButtonText), ), ), ], ), ); } _signup() async { if (_formKey.currentState.validate()) { //signup user if (!await user.signup(_email.text, _password.text)) Scaffold.of(context).showSnackBar(SnackBar( content: Text(user.error), )); } } @override void dispose() { _email.dispose(); _password.dispose(); super.dispose(); } }
0
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation/pages/user_info.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebasestarter/core/presentation/res/analytics.dart'; import 'package:firebasestarter/generated/l10n.dart'; import '../../data/model/user_repository.dart'; class UserInfoPage extends StatelessWidget { final User user; const UserInfoPage({Key key, this.user}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(S.of(context).profilePageTitle), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text(user.email), RaisedButton( child: Text(S.of(context).logoutButtonText), onPressed: () { logEvent(context, AppAnalyticsEvents.logOut); Provider.of<UserRepository>(context, listen: false).signOut(); }, ) ], ), ), ); } }
0
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation/pages/splash.dart
import 'package:flutter/material.dart'; class Splash extends StatelessWidget { @override Widget build(BuildContext context) { return Material( child: Center( child: Text("Splash Screen"), ), ); } }
0
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation/pages/login.dart
import 'package:flutter/material.dart'; import 'package:flutter_auth_buttons/flutter_auth_buttons.dart'; import 'package:firebasestarter/generated/l10n.dart'; import '../../data/model/user_repository.dart'; import '../widgets/auth_dialog.dart'; import 'package:provider/provider.dart'; class WelcomePage extends StatefulWidget { @override _WelcomePageState createState() => _WelcomePageState(); } class _WelcomePageState extends State<WelcomePage> { final GlobalKey<ScaffoldState> _key = GlobalKey<ScaffoldState>(); bool _authVisible; int _selectedTab; @override void initState() { super.initState(); _authVisible = false; _selectedTab = 0; } @override Widget build(BuildContext context) { UserRepository user = Provider.of<UserRepository>(context); return Scaffold( key: _key, body: Stack( children: <Widget>[ Container( decoration: BoxDecoration( color: Colors.grey.shade800, ), width: double.infinity, ), Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ const SizedBox(height: kToolbarHeight), Text( S.of(context).loginPageTitleText, style: Theme.of(context).textTheme.display2.copyWith( color: Colors.white, fontWeight: FontWeight.w900, fontFamily: "Frank"), ), Text( S.of(context).loginPageSubtitleText, style: TextStyle(color: Colors.white, fontSize: 20.0), ), const SizedBox(height: 40.0), Padding( padding: const EdgeInsets.all(8.0), child: Row( children: <Widget>[ Expanded( child: RaisedButton( elevation: 0, highlightElevation: 0, child: Text(S.of(context).loginButtonText), onPressed: () => setState(() { _authVisible = true; _selectedTab = 0; }), ), ), const SizedBox(width: 10.0), Expanded( child: OutlineButton( textColor: Colors.white, child: Text(S.of(context).signupButtonText), onPressed: () => setState(() { _authVisible = true; _selectedTab = 1; }), borderSide: BorderSide(color: Colors.white), ), ), ], ), ), const SizedBox(height: 50.0), GoogleSignInButton( text: S.of(context).googleButtonText, onPressed: () async { if (!await user.signInWithGoogle()) _key.currentState.showSnackBar(SnackBar( content: Text("Something is wrong"), )); }, ), const SizedBox(height: 10.0), ], ), AnimatedSwitcher( duration: Duration(milliseconds: 500), child: _authVisible ? Container( color: Colors.black54, child: Padding( padding: const EdgeInsets.all(16.0), child: AuthDialog( selectedTab: _selectedTab, onClose: () { setState(() { _authVisible = false; }); }, ), ), ) : null, ) ], ), ); } }
0
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation
mirrored_repositories/flutter_firebase_starter/lib/features/auth/presentation/pages/home.dart
import 'package:flutter/material.dart'; import 'package:firebasestarter/core/presentation/res/analytics.dart'; import 'package:firebasestarter/features/home/presentation/pages/home.dart'; import 'package:firebasestarter/features/onboarding/presentation/pages/intro.dart'; import '../../data/model/user_repository.dart'; import 'package:provider/provider.dart'; import './splash.dart'; import './login.dart'; class AuthHomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Consumer( builder: (context, UserRepository user, _) { switch (user.status) { case Status.Unauthenticated: case Status.Authenticating: setCurrentScreen(context, AnalyticsScreenNames.welcome); return WelcomePage(); case Status.Authenticated: setUserProperties(context,id: user.fbUser?.uid, name: user.fbUser?.displayName, email: user.fbUser?.email); setCurrentScreen(context, AnalyticsScreenNames.userInfo); if(user.isLoading) return Splash(); return user.user?.introSeen ?? false ? HomePage() : IntroPage(); case Status.Uninitialized: default: setCurrentScreen(context, AnalyticsScreenNames.splash); return Splash(); } }, ); } }
0
mirrored_repositories/flutter_firebase_starter/lib/features/home/presentation
mirrored_repositories/flutter_firebase_starter/lib/features/home/presentation/pages/home.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:firebasestarter/core/presentation/res/routes.dart'; import 'package:firebasestarter/features/notification/data/service/push_notification_service.dart'; class HomePage extends StatefulWidget { @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { @override void didChangeDependencies() { Provider.of<PushNotificationService>(context).init(); super.didChangeDependencies(); } @override Widget build(BuildContext context){ return Scaffold( appBar: AppBar( title: Text('Firebase starter'), actions: <Widget>[ IconButton( icon: Icon(Icons.person), onPressed: () => Navigator.pushNamed(context, AppRoutes.profile), ) ], ), body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text("Home Page",style: Theme.of(context).textTheme.title,), ], ), ), ); } }
0
mirrored_repositories/flutter_firebase_starter/lib/core/data
mirrored_repositories/flutter_firebase_starter/lib/core/data/res/data_constants.dart
class AppDBConstants { static const String usersCollection = "users"; static const String appSettingsCollection = "app_settings"; static const String usersStorageBucket = "users"; static const String devicesSubCollection = "devices"; }
0
mirrored_repositories/flutter_firebase_starter/lib/core/presentation
mirrored_repositories/flutter_firebase_starter/lib/core/presentation/res/assets.dart
class AppAssets { }
0
mirrored_repositories/flutter_firebase_starter/lib/core/presentation
mirrored_repositories/flutter_firebase_starter/lib/core/presentation/res/themes.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:firebasestarter/core/presentation/res/colors.dart'; import 'package:firebasestarter/core/presentation/res/sizes.dart'; class AppThemes { static BuildContext context; static final ThemeData defaultTheme = ThemeData( primaryColor: AppColors.primaryColor, accentColor: AppColors.accentColor, primarySwatch: Colors.red, buttonColor: AppColors.primaryColor, appBarTheme: AppBarTheme( elevation: 0, ), buttonTheme: ButtonThemeData( buttonColor: AppColors.primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(AppSizes.borderRadius), ), ), textTheme: GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme), ); }
0
mirrored_repositories/flutter_firebase_starter/lib/core/presentation
mirrored_repositories/flutter_firebase_starter/lib/core/presentation/res/sizes.dart
class AppSizes { static const double borderRadius=10.0; }
0
mirrored_repositories/flutter_firebase_starter/lib/core/presentation
mirrored_repositories/flutter_firebase_starter/lib/core/presentation/res/routes.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:firebasestarter/features/auth/presentation/pages/home.dart'; import 'package:firebasestarter/features/auth/presentation/pages/splash.dart'; import 'package:firebasestarter/features/auth/presentation/pages/user_info.dart'; import 'package:firebasestarter/features/profile/presentation/pages/edit_profile.dart'; import 'package:firebasestarter/features/profile/presentation/pages/profile.dart'; class AppRoutes { static const home = "/"; static const splash = "splash"; static const login = "login"; static const signup = "signup"; static const userInfo = "user_info"; static const String profile = "profile"; static const String editProfile = "edit_profile"; static Route<dynamic> onGenerateRoute(RouteSettings settings) { return MaterialPageRoute( settings: settings, builder: (_) { switch (settings.name) { case home: return AuthHomePage(); case userInfo: return UserInfoPage(); case editProfile: return EditProfile(user: settings.arguments,); case profile: return UserProfile(); case splash: default: return Splash(); } } ); } }
0
mirrored_repositories/flutter_firebase_starter/lib/core/presentation
mirrored_repositories/flutter_firebase_starter/lib/core/presentation/res/app_config.dart
import 'package:meta/meta.dart'; enum AppFlavor { dev, prod } class AppConfig { final String appTitle; final AppFlavor buildFlavor; AppConfig({@required this.appTitle, @required this.buildFlavor}); }
0
mirrored_repositories/flutter_firebase_starter/lib/core/presentation
mirrored_repositories/flutter_firebase_starter/lib/core/presentation/res/analytics.dart
import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; import 'package:firebasestarter/core/presentation/res/routes.dart'; class AppAnalyticsEvents { static const String logOut = "log_out"; } class AnalyticsScreenNames { static const String welcome = "Welcome page"; static const String splash = "Splash screen"; static const String login = "Login Screen"; static const String userInfo = "User profile"; static const String root = "Root page"; } FirebaseAnalytics _getAnalytics(BuildContext context) => Provider.of<FirebaseAnalytics>(context, listen: false); Future<void> logEvent(BuildContext context, String name, {Map<String,dynamic> params}) { return _getAnalytics(context).logEvent(name: name, parameters: params); } Future<void> setCurrentScreen(BuildContext context, String name) { return _getAnalytics(context).setCurrentScreen(screenName: name); } Future<void> setUserProperties(BuildContext context, {String id, String name, String email}) async { await _getAnalytics(context).setUserId(id); await _getAnalytics(context).setUserProperty(name: "email", value: email); await _getAnalytics(context).setUserProperty(name: "name", value: name); return; } String analyticsNameExtractor(RouteSettings settings) { switch (settings.name) { case AppRoutes.userInfo: return AnalyticsScreenNames.userInfo; case AppRoutes.login: return AnalyticsScreenNames.login; case AppRoutes.splash: return AnalyticsScreenNames.splash; case AppRoutes.home: default: return AnalyticsScreenNames.root; } }
0
mirrored_repositories/flutter_firebase_starter/lib/core/presentation
mirrored_repositories/flutter_firebase_starter/lib/core/presentation/res/constants.dart
class AppConstants { static const String appName="Firebase starter"; static const String appNameDev="[DEV] Firebase starter"; }
0
mirrored_repositories/flutter_firebase_starter/lib/core/presentation
mirrored_repositories/flutter_firebase_starter/lib/core/presentation/res/colors.dart
import 'package:flutter/material.dart'; class AppColors { static const primaryColor = Color(0xffff414d); static const primaryColorLight = Color(0xfffa897b); static const accentColor = Color(0xff1aa687); static const accentColorLight = Color(0xffd9ecf2); }
0
mirrored_repositories/flutter_firebase_starter/lib/core/presentation
mirrored_repositories/flutter_firebase_starter/lib/core/presentation/providers/providers.dart
import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:provider/provider.dart'; import 'package:provider/single_child_widget.dart'; import 'package:firebasestarter/features/auth/data/model/user_repository.dart'; import 'package:firebasestarter/features/notification/data/service/push_notification_service.dart'; List<SingleChildWidget> providers = [ Provider<FirebaseAnalytics>( create: (_) => FirebaseAnalytics(), ), Provider<PushNotificationService>( create: (context) => PushNotificationService(), ), Consumer<PushNotificationService>( builder: (context, notifService, child) { return ChangeNotifierProvider<UserRepository>( create: (_) => UserRepository.instance(notifService), child: child, ); }, ) ];
0
mirrored_repositories/flutter_firebase_starter/lib
mirrored_repositories/flutter_firebase_starter/lib/generated/l10n.dart
// GENERATED CODE - DO NOT MODIFY BY HAND import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'intl/messages_all.dart'; // ************************************************************************** // Generator: Flutter Intl IDE plugin // Made by Localizely // ************************************************************************** // ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars // ignore_for_file: join_return_with_assignment, prefer_final_in_for_each // ignore_for_file: avoid_redundant_argument_values class S { S(); static S current; static const AppLocalizationDelegate delegate = AppLocalizationDelegate(); static Future<S> load(Locale locale) { final name = (locale.countryCode?.isEmpty ?? false) ? locale.languageCode : locale.toString(); final localeName = Intl.canonicalizedLocale(name); return initializeMessages(localeName).then((_) { Intl.defaultLocale = localeName; S.current = S(); return S.current; }); } static S of(BuildContext context) { return Localizations.of<S>(context, S); } /// `Firebase starter` String get appName { return Intl.message( 'Firebase starter', name: 'appName', desc: '', args: [], ); } /// `Login` String get loginButtonText { return Intl.message( 'Login', name: 'loginButtonText', desc: '', args: [], ); } /// `Sign up` String get signupButtonText { return Intl.message( 'Sign up', name: 'signupButtonText', desc: '', args: [], ); } /// `Continue with Google` String get googleButtonText { return Intl.message( 'Continue with Google', name: 'googleButtonText', desc: '', args: [], ); } /// `Welcome` String get loginPageTitleText { return Intl.message( 'Welcome', name: 'loginPageTitleText', desc: '', args: [], ); } /// `Our awesome login app` String get loginPageSubtitleText { return Intl.message( 'Our awesome login app', name: 'loginPageSubtitleText', desc: '', args: [], ); } /// `Email` String get emailFieldlabel { return Intl.message( 'Email', name: 'emailFieldlabel', desc: '', args: [], ); } /// `Password` String get passwordFieldLabel { return Intl.message( 'Password', name: 'passwordFieldLabel', desc: '', args: [], ); } /// `Please enter email` String get emailValidationError { return Intl.message( 'Please enter email', name: 'emailValidationError', desc: '', args: [], ); } /// `Please enter password` String get passwordValidationError { return Intl.message( 'Please enter password', name: 'passwordValidationError', desc: '', args: [], ); } /// `Please confirm password` String get confirmPasswordValidationEmptyError { return Intl.message( 'Please confirm password', name: 'confirmPasswordValidationEmptyError', desc: '', args: [], ); } /// `Passwords do not match` String get confirmPasswordValidationMatchError { return Intl.message( 'Passwords do not match', name: 'confirmPasswordValidationMatchError', desc: '', args: [], ); } /// `Confirm password` String get confirmPasswordFieldLabel { return Intl.message( 'Confirm password', name: 'confirmPasswordFieldLabel', desc: '', args: [], ); } /// `Log out` String get logoutButtonText { return Intl.message( 'Log out', name: 'logoutButtonText', desc: '', args: [], ); } /// `Profile` String get profilePageTitle { return Intl.message( 'Profile', name: 'profilePageTitle', desc: '', args: [], ); } /// `Name` String get nameFieldLabel { return Intl.message( 'Name', name: 'nameFieldLabel', desc: '', args: [], ); } /// `Edit Profile` String get editProfile { return Intl.message( 'Edit Profile', name: 'editProfile', desc: '', args: [], ); } /// `Save` String get saveButtonLabel { return Intl.message( 'Save', name: 'saveButtonLabel', desc: '', args: [], ); } /// `Gallery` String get pickFromGalleryButtonLabel { return Intl.message( 'Gallery', name: 'pickFromGalleryButtonLabel', desc: '', args: [], ); } /// `Take Photo` String get pickFromCameraButtonLabel { return Intl.message( 'Take Photo', name: 'pickFromCameraButtonLabel', desc: '', args: [], ); } /// `Cancel` String get cancelButtonLabel { return Intl.message( 'Cancel', name: 'cancelButtonLabel', desc: '', args: [], ); } /// `Pick Image` String get pickImageDialogTitle { return Intl.message( 'Pick Image', name: 'pickImageDialogTitle', desc: '', args: [], ); } /// `Get Started` String get introFinishButtonLabel { return Intl.message( 'Get Started', name: 'introFinishButtonLabel', desc: '', args: [], ); } } class AppLocalizationDelegate extends LocalizationsDelegate<S> { const AppLocalizationDelegate(); List<Locale> get supportedLocales { return const <Locale>[ Locale.fromSubtags(languageCode: 'en'), ]; } @override bool isSupported(Locale locale) => _isSupported(locale); @override Future<S> load(Locale locale) => S.load(locale); @override bool shouldReload(AppLocalizationDelegate old) => false; bool _isSupported(Locale locale) { if (locale != null) { for (var supportedLocale in supportedLocales) { if (supportedLocale.languageCode == locale.languageCode) { return true; } } } return false; } }
0
mirrored_repositories/flutter_firebase_starter/lib/generated
mirrored_repositories/flutter_firebase_starter/lib/generated/intl/messages_en.dart
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that provides messages for a en locale. All the // messages from the main program should be duplicated here with the same // function name. // Ignore issues from commonly used lints in this file. // ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases // ignore_for_file:unused_import, file_names import 'package:intl/intl.dart'; import 'package:intl/message_lookup_by_library.dart'; final messages = new MessageLookup(); typedef String MessageIfAbsent(String messageStr, List<dynamic> args); class MessageLookup extends MessageLookupByLibrary { String get localeName => 'en'; final messages = _notInlinedMessages(_notInlinedMessages); static _notInlinedMessages(_) => <String, Function> { "appName" : MessageLookupByLibrary.simpleMessage("Firebase starter"), "cancelButtonLabel" : MessageLookupByLibrary.simpleMessage("Cancel"), "confirmPasswordFieldLabel" : MessageLookupByLibrary.simpleMessage("Confirm password"), "confirmPasswordValidationEmptyError" : MessageLookupByLibrary.simpleMessage("Please confirm password"), "confirmPasswordValidationMatchError" : MessageLookupByLibrary.simpleMessage("Passwords do not match"), "editProfile" : MessageLookupByLibrary.simpleMessage("Edit Profile"), "emailFieldlabel" : MessageLookupByLibrary.simpleMessage("Email"), "emailValidationError" : MessageLookupByLibrary.simpleMessage("Please enter email"), "googleButtonText" : MessageLookupByLibrary.simpleMessage("Continue with Google"), "introFinishButtonLabel" : MessageLookupByLibrary.simpleMessage("Get Started"), "loginButtonText" : MessageLookupByLibrary.simpleMessage("Login"), "loginPageSubtitleText" : MessageLookupByLibrary.simpleMessage("Our awesome login app"), "loginPageTitleText" : MessageLookupByLibrary.simpleMessage("Welcome"), "logoutButtonText" : MessageLookupByLibrary.simpleMessage("Log out"), "nameFieldLabel" : MessageLookupByLibrary.simpleMessage("Name"), "passwordFieldLabel" : MessageLookupByLibrary.simpleMessage("Password"), "passwordValidationError" : MessageLookupByLibrary.simpleMessage("Please enter password"), "pickFromCameraButtonLabel" : MessageLookupByLibrary.simpleMessage("Take Photo"), "pickFromGalleryButtonLabel" : MessageLookupByLibrary.simpleMessage("Gallery"), "pickImageDialogTitle" : MessageLookupByLibrary.simpleMessage("Pick Image"), "profilePageTitle" : MessageLookupByLibrary.simpleMessage("Profile"), "saveButtonLabel" : MessageLookupByLibrary.simpleMessage("Save"), "signupButtonText" : MessageLookupByLibrary.simpleMessage("Sign up") }; }
0
mirrored_repositories/flutter_firebase_starter/lib/generated
mirrored_repositories/flutter_firebase_starter/lib/generated/intl/messages_all.dart
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that looks up messages for specific locales by // delegating to the appropriate library. // Ignore issues from commonly used lints in this file. // ignore_for_file:implementation_imports, file_names, unnecessary_new // ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering // ignore_for_file:argument_type_not_assignable, invalid_assignment // ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases // ignore_for_file:comment_references import 'dart:async'; import 'package:intl/intl.dart'; import 'package:intl/message_lookup_by_library.dart'; import 'package:intl/src/intl_helpers.dart'; import 'messages_en.dart' as messages_en; typedef Future<dynamic> LibraryLoader(); Map<String, LibraryLoader> _deferredLibraries = { 'en': () => new Future.value(null), }; MessageLookupByLibrary _findExact(String localeName) { switch (localeName) { case 'en': return messages_en.messages; default: return null; } } /// User programs should call this before using [localeName] for messages. Future<bool> initializeMessages(String localeName) async { var availableLocale = Intl.verifiedLocale( localeName, (locale) => _deferredLibraries[locale] != null, onFailure: (_) => null); if (availableLocale == null) { return new Future.value(false); } var lib = _deferredLibraries[availableLocale]; await (lib == null ? new Future.value(false) : lib()); initializeInternalMessageLookup(() => new CompositeMessageLookup()); messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor); return new Future.value(true); } bool _messagesExistFor(String locale) { try { return _findExact(locale) != null; } catch (e) { return false; } } MessageLookupByLibrary _findGeneratedMessagesFor(String locale) { var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); if (actualLocale == null) return null; return _findExact(actualLocale); }
0
mirrored_repositories/flutter_firebase_starter
mirrored_repositories/flutter_firebase_starter/integration_test/app_test.dart
import 'package:firebasestarter/features/onboarding/presentation/pages/intro.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'package:firebasestarter/main_test.dart' as app; void main() { final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized() as IntegrationTestWidgetsFlutterBinding; testWidgets("Verify Login screen", (WidgetTester tester) async { app.main(); await binding.traceAction(() async { await tester.pumpAndSettle(); expect( find.byWidgetPredicate((Widget widget) => widget is Text && widget.data.startsWith('Login')), findsOneWidget); final loginFinder = find.byWidgetPredicate((widget) => widget is RaisedButton && widget.child is Text && (widget.child as Text).data.startsWith('Login')); expect(loginFinder, findsOneWidget); await tester.tap(loginFinder); await tester.pumpAndSettle(); final emailField = find.byKey(Key("email-field")); expect(emailField, findsOneWidget); await tester.tap(emailField); await tester.enterText(emailField, "test2@testmail.com"); final passwordField = find.byKey(Key("password-field")); expect(passwordField, findsOneWidget); await tester.tap(passwordField); await tester.enterText(passwordField, "testtest"); await tester.pump(); final loginButton = find.byKey(Key("login-button")); expect(loginButton, findsOneWidget); await tester.tap(loginButton); await tester.pumpAndSettle(Duration(seconds: 10)); expect(find.byWidgetPredicate((widget) => widget is IntroPage),findsOneWidget); }); }); }
0
mirrored_repositories/flutter_firebase_starter
mirrored_repositories/flutter_firebase_starter/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:firebasestarter/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/flutter_firebase_starter
mirrored_repositories/flutter_firebase_starter/test_driver/integration_test.dart
import 'package:integration_test/integration_test_driver.dart'; Future<void> main() => integrationDriver();
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/webdevinformation.dart
import 'package:flutter/material.dart'; class WebDevInformation extends StatelessWidget { final Image webDevBanner = const Image( image: ExactAssetImage("assets/images/webdev-banner.jpg"), width: double.infinity, ); final Text webDevText = const Text( "We conceptualize, wire frame and design modern websites. Our clients include individuals, corporations and organizations seeking a detailed, clean and functional approach to conveying their message.", textAlign: TextAlign.center, style: TextStyle( height: 3.0, fontSize: 14, color: Color.fromRGBO(255, 255, 255, 1), ), ); final Image webDevIcon = const Image( image: ExactAssetImage("assets/images/webdev-icon.png"), height: 200.0, width: double.infinity, // alignment: FractionalOffset.center, ); const WebDevInformation({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.only(top: 0.0), child: Column( children: [ webDevBanner, Container(padding: const EdgeInsets.all(10.0), child: webDevText), webDevIcon ], ), ); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/content-creation-page.dart
import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; import 'content-creation-information.dart'; import 'homepage.dart'; class ContentPage extends StatefulWidget { const ContentPage({Key? key}) : super(key: key); @override State<StatefulWidget> createState() => _ContentPageState(); } class _ContentPageState extends State<ContentPage> { final Image applogo = const Image( image: ExactAssetImage("assets/images/Digita-Global-logo.png"), height: 70.0, width: 160.0, alignment: FractionalOffset.center, ); var urlLink = 'https://digitaglobalredesign.000webhostapp.com'; int _selectedIndex = 0; // ignore: non_constant_identifier_names void _LaunchURL(String url) async { try { await launch(url); } catch (e) { throw 'could not launch $url because of $e'; } } void _onItemTapped(int index) { setState(() { _selectedIndex = index; if (index == 0) { Navigator.pushAndRemoveUntil( context, MaterialPageRoute( builder: (context) => const HomePage(), ), (route) => false); } else if (index == 1) { _LaunchURL(urlLink); } }); } @override Widget build(BuildContext context) { return (Scaffold( appBar: AppBar( backgroundColor: const Color.fromRGBO(9, 31, 68, 1), title: Center( child: applogo, )), body: SingleChildScrollView( child: Column( children: const [ContentInformation()], ), ), backgroundColor: const Color.fromRGBO(27, 92, 203, 0.7), bottomNavigationBar: BottomNavigationBar( items: const [ BottomNavigationBarItem( icon: Icon(Icons.arrow_back), label: 'Back to Top', ), BottomNavigationBarItem( icon: Icon(Icons.web_rounded), label: 'To Web', ) ], currentIndex: _selectedIndex, onTap: _onItemTapped, backgroundColor: const Color.fromRGBO(9, 31, 68, 1), ), )); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/marketing-information.dart
// ignore_for_file: avoid_unnecessary_containers import 'package:flutter/material.dart'; class MarketingInformation extends StatelessWidget { final Image marketingBanner = const Image( image: ExactAssetImage("assets/images/marketing-banner.jpg"), // height: double.maxFinite, width: double.infinity, // alignment: FractionalOffset.center, ); final Image marketingIcon = const Image( image: ExactAssetImage("assets/images/marketing-icon.png"), height: 200.0, width: double.infinity, // alignment: FractionalOffset.center, ); final Text marketingText = const Text( "Brands that take advantage of online marketing have reported as much as a 76% increase in both direct and indirect sales, as well as brand affinity! #TeamDigita offers winning digital solutions, inclusive of digital media marketing, strategy and content creation and online advertising.", textAlign: TextAlign.center, style: TextStyle( height: 3.0, fontSize: 14, color: Color.fromRGBO(255, 255, 255, 1), ), ); const MarketingInformation({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.only(top: 0.0), child: Column( children: [ marketingBanner, Container(padding: const EdgeInsets.all(10.0), child: marketingText), marketingIcon ], ), ); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/graphic-information.dart
import 'package:flutter/material.dart'; class GraphicInformation extends StatelessWidget { final Image graphicBanner = const Image( image: ExactAssetImage("assets/images/graphic-design-banner.webp"), width: double.infinity, ); final Text graphicText = const Text( "Collectively, our team has more than 10 years of design experience both as ideators and executors of ground-breaking design concepts. From logos, flyers to brochures, signs and billboards, we are your one stop shop for amazingly engaging visuals.", textAlign: TextAlign.center, style: TextStyle( height: 3.0, fontSize: 14, color: Color.fromRGBO(255, 255, 255, 1), ), ); final Image graphicIcon = const Image( image: ExactAssetImage("assets/images/graphic-icon.png"), height: 200.0, width: double.infinity, // alignment: FractionalOffset.center, ); const GraphicInformation({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.only(top: 0.0), child: Column( children: [ graphicBanner, Container(padding: const EdgeInsets.all(10.0), child: graphicText), graphicIcon ], ), ); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/homepage.dart
// ignore_for_file: avoid_print import 'package:flutter/material.dart'; import 'marketing-information.dart'; import 'graphic-design-page.dart'; class HomePage extends StatelessWidget { const HomePage({Key? key}) : super(key: key); final Image applogo = const Image( image: ExactAssetImage("assets/images/Digita-Global-logo.png"), height: 70.0, width: 160.0, alignment: FractionalOffset.center, ); @override Widget build(BuildContext context) { void handleActionButton() { Navigator.push( context, MaterialPageRoute( builder: (context) => const GraphicPage(), )); } return (Scaffold( appBar: AppBar( backgroundColor: const Color.fromRGBO(9, 31, 68, 1), title: Center( child: applogo, )), body: SingleChildScrollView( child: Column( children: const [MarketingInformation()], ), ), backgroundColor: const Color.fromRGBO(27, 92, 203, 0.7), floatingActionButton: FloatingActionButton( onPressed: handleActionButton, backgroundColor: const Color.fromRGBO(190, 105, 10, 1), child: const Icon(Icons.skip_next), ), )); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/splashscreen.dart
// ignore_for_file: use_build_context_synchronously import 'package:flutter/material.dart'; import 'homepage.dart'; class Splash extends StatefulWidget { const Splash({Key? key}) : super(key: key); @override _SplashState createState() => _SplashState(); } class _SplashState extends State<Splash> { final Image splashScreenLogo = const Image( image: ExactAssetImage("assets/images/Digita-Global-logo.png"), height: 70.0, width: 160.0, alignment: FractionalOffset.center, ); @override void initState() { super.initState(); _navigatetohome(); } _navigatetohome() async { await Future.delayed(const Duration(seconds: 3), () {}); Navigator.pushReplacement( context, MaterialPageRoute(builder: (context) => const HomePage()), ); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( padding: const EdgeInsets.all(10.0), height: 80.0, width: 300.0, color: const Color.fromRGBO(255, 255, 255, 1), child: splashScreenLogo, )), backgroundColor: const Color.fromRGBO(15, 51, 113, 1), ); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/webdevpage.dart
import 'package:app/content-creation-information.dart'; import 'package:flutter/material.dart'; import 'webdevinformation.dart'; import 'content-creation-page.dart'; class WebDevelopmentPage extends StatelessWidget { final Image applogo = const Image( image: ExactAssetImage("assets/images/Digita-Global-logo.png"), height: 70.0, width: 160.0, alignment: FractionalOffset.center, ); const WebDevelopmentPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { void handleActionButton() { Navigator.push( context, MaterialPageRoute( builder: (context) => const ContentPage(), )); } return (Scaffold( appBar: AppBar( backgroundColor: const Color.fromRGBO(9, 31, 68, 1), title: Center( child: applogo, )), body: SingleChildScrollView( child: Column( children: const [WebDevInformation()], ), ), backgroundColor: const Color.fromRGBO(27, 92, 203, 0.7), floatingActionButton: FloatingActionButton( onPressed: handleActionButton, backgroundColor: const Color.fromRGBO(190, 105, 10, 1), child: const Icon(Icons.skip_next), ), )); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/main.dart
import 'package:flutter/material.dart'; import 'splashscreen.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); // This widget is the root of your application. @override Widget build(BuildContext context) { return const MaterialApp( home: Splash(), ); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/content-creation-information.dart
import 'package:flutter/material.dart'; class ContentInformation extends StatelessWidget { final Image contentBanner = const Image( image: ExactAssetImage("assets/images/content-banner.jpg"), width: double.infinity, ); final Text contentText = const Text( "Do you have an exciting idea that you want to bring to life? We've got the right mix of talent and creative skills to help you go from concept to reality. We have over 20 years experience creating rich and engaging visuals that help perfectly communicate your message.", textAlign: TextAlign.center, style: TextStyle( height: 3.0, fontSize: 14, color: Color.fromRGBO(255, 255, 255, 1), ), ); final Image contentIcon = const Image( image: ExactAssetImage("assets/images/content-icon.png"), height: 200.0, width: double.infinity, // alignment: FractionalOffset.center, ); const ContentInformation({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.only(top: 0.0), child: Column( children: [ contentBanner, Container(padding: const EdgeInsets.all(10.0), child: contentText), contentIcon ], ), ); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/lib/graphic-design-page.dart
// ignore: file_names import 'package:flutter/material.dart'; import 'graphic-information.dart'; import 'webdevpage.dart'; class GraphicPage extends StatelessWidget { final Image applogo = const Image( image: ExactAssetImage("assets/images/Digita-Global-logo.png"), height: 70.0, width: 160.0, alignment: FractionalOffset.center, ); const GraphicPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { void handleActionButton() { Navigator.push( context, MaterialPageRoute( builder: (context) => const WebDevelopmentPage(), )); } return (Scaffold( appBar: AppBar( backgroundColor: const Color.fromRGBO(9, 31, 68, 1), title: Center( child: applogo, )), body: SingleChildScrollView( child: Column( children: const [GraphicInformation()], ), ), backgroundColor: const Color.fromRGBO(27, 92, 203, 0.7), floatingActionButton: FloatingActionButton( onPressed: handleActionButton, backgroundColor: const Color.fromRGBO(190, 105, 10, 1), child: const Icon(Icons.skip_next), ), )); } }
0
mirrored_repositories/Digita_Global_Marketing_App
mirrored_repositories/Digita_Global_Marketing_App/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/gamaru-mobile-app
mirrored_repositories/gamaru-mobile-app/lib/earn_screen.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Main-Controller/mainController.dart'; import 'package:gamaru_mobile_app/Screens/Top-section-every/top-part.dart'; // import 'package:gamaru_mobile_app/Screens/Wallet-Screens/upi_payment_screen.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import 'Screens/refer_screen/refer_earn_screen.dart'; import 'Screens/watchAndEarn/watchEarn.dart'; class EarnScreen extends StatelessWidget { const EarnScreen({super.key}); @override Widget build(BuildContext context) { final mainController = Get.put(MainController()); return Scaffold( backgroundColor: Colors.black, body: SafeArea( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 5.0), child: Column( children: [ const TopDetails(), Container( height: Get.height - 146, padding: const EdgeInsets.only(top: 20), child: ListView( children: [ GlossyCard( height: Get.height * 0.26, width: Get.width * 0.95, borderRadius: 10.0, borderWith: 1.0, child: InkWell( onTap: () { Get.to(const ReferAndEarn()); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ LottieBuilder.asset( "Assets/refer.json", height: 175, width: 175, repeat: false, ), Container( padding: const EdgeInsets.only(right: 10), child: const Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "Refer and Earn", style: TextStyle( color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold), ), SizedBox( height: 4, ), Text( "Tell your mates about this app", style: TextStyle( color: Colors.white70, fontSize: 14), ), Text( "and get exciting reward", style: TextStyle( color: Colors.white70, fontSize: 14), ) ]), ) ], ), )), const SizedBox( height: 8, ), GlossyCard( height: Get.height * 0.26, width: Get.width * 0.95, borderRadius: 10.0, borderWith: 1.0, child: InkWell( onTap: () { // Get.to(UpiScreen()); Get.snackbar( "No Data Available", "Please ry again later", colorText: Colors.white, ); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ LottieBuilder.asset( "Assets/socal.json", height: 175, width: 175, repeat: false, ), Container( padding: const EdgeInsets.only(right: 10), child: const Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "Share and Earn", style: TextStyle( color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold), ), SizedBox( height: 4, ), Text( "Share on social media about", style: TextStyle( color: Colors.white70, fontSize: 14), ), Text( "our app and earn huge", style: TextStyle( color: Colors.white70, fontSize: 14), ) ]), ) ], ), )), const SizedBox( height: 8, ), GlossyCard( height: Get.height * 0.26, width: Get.width * 0.95, borderRadius: 10.0, borderWith: 1.0, child: InkWell( onTap: () { Get.to(const WatchAndEarn()); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ LottieBuilder.asset( "Assets/adWatch.json", height: 175, width: 175, repeat: false, ), Container( padding: const EdgeInsets.only(right: 10), child: const Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "Watch and Earn", style: TextStyle( color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold), ), SizedBox( height: 4, ), Text( "Watch promotional videos and", style: TextStyle( color: Colors.white70, fontSize: 14), ), Text( "get exciting reward", style: TextStyle( color: Colors.white70, fontSize: 14), ) ]), ) ], ), )), const SizedBox( height: 8, ), InkWell( onTap: () { mainController.navBarIndex.value = 1; }, child: GlossyCard( height: Get.height * 0.26, width: Get.width * 0.95, borderRadius: 10.0, borderWith: 1.0, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ LottieBuilder.asset( "Assets/playgame.json", height: 175, width: 175, repeat: false, ), Container( padding: const EdgeInsets.only(right: 10), child: const Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "Play and Earn", style: TextStyle( color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold), ), SizedBox( height: 4, ), Text( "Play your favrouit games daily", style: TextStyle( color: Colors.white70, fontSize: 14), ), Text( "and win daily", style: TextStyle( color: Colors.white70, fontSize: 14), ) ], ), ) ], )), ), const SizedBox( height: 8, ), ], ), ) ], ), ), )); } }
0
mirrored_repositories/gamaru-mobile-app
mirrored_repositories/gamaru-mobile-app/lib/game_screen.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Event-controller/eventController.dart'; import 'package:gamaru_mobile_app/Controllers/User-Controller/userController.dart'; import 'package:gamaru_mobile_app/Screens/Game-Screen/event.dart'; import 'package:gamaru_mobile_app/Screens/result-screen/result_card.dart'; import 'package:gamaru_mobile_app/Screens/result-screen/result_screen.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; import 'package:liquid_pull_to_refresh/liquid_pull_to_refresh.dart'; import 'package:lottie/lottie.dart'; class GameScreen extends StatefulWidget { final gameName; const GameScreen({super.key, required this.gameName}); @override State<GameScreen> createState() => _GameScreenState(); } class _GameScreenState extends State<GameScreen> { final userController = Get.put(UserController()); Future<void> _handleRequest() async { setState(() {}); } @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return DefaultTabController( length: 2, child: DefaultTabController( length: 2, initialIndex: 0, child: Scaffold( backgroundColor: Colors.black, extendBodyBehindAppBar: false, appBar: AppBar( backgroundColor: Colors.black, title: Text( widget.gameName, style: const TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 20), ), leading: const BackButton( color: Colors.white, ), centerTitle: true, titleSpacing: 5, // elevation: 20, bottom: const TabBar( indicatorColor: Colors.purple, indicatorWeight: 3, tabs: [ Tab( // text: "Upcomming Event", child: Text( "Upcomming", style: TextStyle(color: Colors.white), ), ), Tab( child: Text( "Result", style: TextStyle(color: Colors.white), ), ) ]), ), body: widget.gameName == "LUDO" || widget.gameName == "CARROM" ? Container( color: Colors.black, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ LottieBuilder.asset("Assets/NoData.json"), Text( "Comming Soon", style: TextStyle(color: Colors.white70, fontSize: 20), ) ], ), ) : TabBarView( physics: const BouncingScrollPhysics(), dragStartBehavior: DragStartBehavior.down, children: [ Container( color: Colors.black, child: StreamBuilder( stream: FirebaseFirestore.instance .collection(widget.gameName.toString()) .doc("upcoming") .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { List arr = snapshot.data!.data()!["event"]; return LiquidPullToRefresh( color: const Color.fromARGB(255, 37, 72, 101), animSpeedFactor: 3, springAnimationDurationInMilliseconds: 600, onRefresh: _handleRequest, backgroundColor: Color.fromARGB(255, 220, 19, 255), child: ListView.builder( itemCount: arr.length, itemBuilder: (context, index) { var l = arr[index]; Timestamp t = l["eventTime"]; DateTime dt = t.toDate(); List rList = l["eventRegisteredPlayers"]; return EventCard( index: index, registerList: rList, eventEntryFee: l["eventEntryFee"], eventMap: l["eventMap"], eventName: l["eventName"], eventPerKill: l["eventPerKill"], eventRegisteredPlayers: rList.length, eventTime: dt, eventTotalPlayers: l["eventTotalPlayers"], eventWinner: l["eventWinner"], id: l["id"], pass: l["pass"], ); }, ), ); } else { return const Center( child: SizedBox( height: 50, width: 50, child: CircularProgressIndicator( backgroundColor: Colors.grey, )), ); } }, )), // FOR RESULT PAGE const ResultScreen(), ], )), ), ); } }
0
mirrored_repositories/gamaru-mobile-app
mirrored_repositories/gamaru-mobile-app/lib/firebase_options.dart
// File generated by FlutterFire CLI. // ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; /// Default [FirebaseOptions] for use with your Firebase apps. /// /// Example: /// ```dart /// import 'firebase_options.dart'; /// // ... /// await Firebase.initializeApp( /// options: DefaultFirebaseOptions.currentPlatform, /// ); /// ``` class DefaultFirebaseOptions { static FirebaseOptions get currentPlatform { if (kIsWeb) { return web; } switch (defaultTargetPlatform) { case TargetPlatform.android: return android; case TargetPlatform.iOS: return ios; case TargetPlatform.macOS: return macos; case TargetPlatform.windows: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for windows - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); case TargetPlatform.linux: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for linux - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); default: throw UnsupportedError( 'DefaultFirebaseOptions are not supported for this platform.', ); } } static const FirebaseOptions web = FirebaseOptions( apiKey: 'AIzaSyAABS4EnG5eefb06XpT6iQ7KMPaDHrVJZo', appId: '1:119833315096:web:270b4b7481bc3c7bf0806d', messagingSenderId: '119833315096', projectId: 'gamaru-mobile-app', authDomain: 'gamaru-mobile-app.firebaseapp.com', storageBucket: 'gamaru-mobile-app.appspot.com', measurementId: 'G-GVWK3G0F1W', ); static const FirebaseOptions android = FirebaseOptions( apiKey: 'AIzaSyBi5dKocY8FMDdp7YmHv6RtuDG7PjoANmM', appId: '1:119833315096:android:3b6f4fd488b2f98bf0806d', messagingSenderId: '119833315096', projectId: 'gamaru-mobile-app', storageBucket: 'gamaru-mobile-app.appspot.com', ); static const FirebaseOptions ios = FirebaseOptions( apiKey: 'AIzaSyAqjBbp6mnMT7YB0jpvvB6pAdXq5TEPWbc', appId: '1:119833315096:ios:1bd9a5bc74a9072df0806d', messagingSenderId: '119833315096', projectId: 'gamaru-mobile-app', storageBucket: 'gamaru-mobile-app.appspot.com', iosClientId: '119833315096-3pk8781mf9p0gnbj6qd34qdk11blqdmn.apps.googleusercontent.com', iosBundleId: 'com.example.gamaruMobileApp', ); static const FirebaseOptions macos = FirebaseOptions( apiKey: 'AIzaSyAqjBbp6mnMT7YB0jpvvB6pAdXq5TEPWbc', appId: '1:119833315096:ios:0b9d7f6e52ab705df0806d', messagingSenderId: '119833315096', projectId: 'gamaru-mobile-app', storageBucket: 'gamaru-mobile-app.appspot.com', iosClientId: '119833315096-jd5ph3lvg0afcd0so3q261p4fbldhff2.apps.googleusercontent.com', iosBundleId: 'com.example.gamaruMobileApp.RunnerTests', ); }
0
mirrored_repositories/gamaru-mobile-app
mirrored_repositories/gamaru-mobile-app/lib/main.dart
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/Home-Screen/homeScreen.dart'; import 'package:gamaru_mobile_app/Screens/Home-Screen/home_shimmer.dart'; import 'package:gamaru_mobile_app/Screens/navigation_bar.dart'; import 'package:get/get.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import 'package:permission_handler/permission_handler.dart'; import 'Controllers/Login-Contollers/autehntication.dart'; import 'firebase_options.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); MobileAds.instance.initialize(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ).then((_) => Get.put(Authentication())); await Permission.notification.isDenied.then((value) { if (value) { Permission.notification.request(); } }); final fcmTocken = await FirebaseMessaging.instance.getToken().then( (value) { print( 'token kfghfghfhghjgjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj = ' + value.toString()); }, ); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return GetMaterialApp( debugShowCheckedModeBanner: false, title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: const HomeShimmer(), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib
mirrored_repositories/gamaru-mobile-app/lib/Screens/navigation_bar.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyExtra.dart'; import 'package:gamaru_mobile_app/Controllers/Main-Controller/mainController.dart'; import 'package:gamaru_mobile_app/Screens/Profile-Screen/profileScreen.dart'; import 'package:gamaru_mobile_app/Screens/app_update/update_screen.dart'; import 'package:get/get.dart'; import 'package:icons_plus/icons_plus.dart'; import 'package:lottie/lottie.dart'; import '../earn_screen.dart'; import 'Home-Screen/homeScreen.dart'; class MainScreen extends StatefulWidget { @override _MainScreenState createState() => _MainScreenState(); } class _MainScreenState extends State<MainScreen> { final mainController = Get.put(MainController()); List<Widget> _pages = [ EarnScreen(), HomeScreen(), ProfileScreen1(), ]; @override void initState() { super.initState(); mainController.getUrls(); } @override Widget build(BuildContext context) { return Obx(() => mainController.is_loading.value ? const UpdateScreen() : Scaffold( backgroundColor: Colors.black, body: _pages[mainController.navBarIndex.value], bottomNavigationBar: EnhancedNavigationBar( currentIndex: mainController.navBarIndex.value, onTap: (index) { mainController.navBarIndex.value = index; }, ), )); } } class EnhancedNavigationBar extends StatelessWidget { final int currentIndex; final Function(int) onTap; EnhancedNavigationBar({required this.currentIndex, required this.onTap}); @override Widget build(BuildContext context) { return // Container( // height: 80.0, // color: Colors.white, // ), GlossyCardDark( height: 62.5, width: Get.width, borderRadius: 0.0, borderWith: 0.0000001, child: Container( padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ _buildNavItem(HeroIcons.fire, "Earn", 0), _buildNavItem(Iconsax.game, "Games", 1), _buildNavItem(Iconsax.profile_circle, "Profile", 2), ], ), ), ); } Widget _buildNavItem(IconData icon, String label, int index) { return InkWell( onTap: () { onTap(index); }, child: Container( width: 80, child: Column( mainAxisSize: MainAxisSize.min, children: [ Icon( icon, color: currentIndex == index ? Colors.green : Colors.white60, // size: currentIndex == index ? Size(12, 12) : Size(10, 10), ), const SizedBox(height: 2.0), Text( label, style: TextStyle( color: currentIndex == index ? Colors.green : Colors.white60, fontSize: currentIndex == index ? 14 : 13, ), ), ], ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Profile-Screen/profileScreen.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/background_style.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Componants/glossy_prof.dart'; import 'package:gamaru_mobile_app/Controllers/Wallet-Controller/walletController.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/addMoney.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/transaction-screen.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/withdrawl.dart'; import 'package:gamaru_mobile_app/Screens/app_update/update_screen.dart'; import 'package:gamaru_mobile_app/Screens/coins-exchange-screen/exchange_screen.dart'; import 'package:gamaru_mobile_app/Screens/notifications-screen/notification.dart'; import 'package:get/get.dart'; import 'package:icons_plus/icons_plus.dart'; import 'package:random_avatar/random_avatar.dart'; import '../../Controllers/Login-Contollers/autehntication.dart'; import '../Customer Support/SupportScreen.dart'; import '../refer_screen/refer_earn_screen.dart'; class ProfileScreen1 extends StatelessWidget { const ProfileScreen1({super.key}); @override Widget build(BuildContext context) { final authentication = Get.put(Authentication()); final walletController = Get.put(WalletController()); walletController.myWalletStatus.value = false; return Scaffold( body: Stack( alignment: Alignment.bottomCenter, children: [ Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("Assets/bg_profile.JPG"), fit: BoxFit.cover)), ), GlossyCardDarkProf( height: Get.height * 0.7, width: Get.width, borderRadius: 30.0, borderWith: 0.0, child: Container(), ), Positioned( top: Get.height - Get.height * 0.85, child: Container( height: 150, width: 150, decoration: BoxDecoration( boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), blurRadius: 8.0, // soften the shadow spreadRadius: 0.2, //extend the shadow ) ], color: Colors.transparent, border: Border.all(color: Colors.black, width: 5), borderRadius: const BorderRadius.all(Radius.circular(75))), child: RandomAvatar( authentication.userEmail.value, ), )), Positioned( top: Get.height - Get.height * 0.65, child: SizedBox( width: Get.width - 60, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Obx( () => Text( authentication.userEmail.value, style: const TextStyle( color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600), ), ) ], ), const SizedBox( height: 25, ), Obx( () => GlossyCard( borderRadius: 10.0, borderWith: 1.0, height: walletController.myWalletStatus.value ? 250.0 : 50.0, width: Get.width, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ InkWell( onTap: () { walletController.myWalletStatus.value = !walletController.myWalletStatus.value; }, child: Row( children: [ const SizedBox( width: 10, ), const Icon( HeroIcons.wallet, color: Colors.white70, size: 35, ), const SizedBox( width: 20, ), const Text( "My Wallet", style: TextStyle( color: Colors.white, fontSize: 20), ), SizedBox( width: Get.width * .35, ), walletController.myWalletStatus.value ? const Icon( Icons.arrow_drop_up_rounded, color: Colors.white, size: 40, ) : const Icon( Icons.arrow_drop_down_rounded, color: Colors.white, size: 40, ) ], ), ), walletController.myWalletStatus.value ? Divider() : const Text( "", style: TextStyle(fontSize: 0), ), walletController.myWalletStatus.value ? Container( child: Column(children: [ InkWell( onTap: () { Get.to(() => AddMoney()); }, child: const Row( children: [ SizedBox( width: 10, ), Icon( HeroIcons.bolt, color: Colors.white70, size: 35, ), SizedBox( width: 20, ), Text( "Recharge", style: TextStyle( color: Colors.white, fontSize: 20), ), ], ), ), const SizedBox( height: 10, ), InkWell( onTap: () { Get.to(() => const ExchangeScreen()); }, child: const Row( children: [ SizedBox( width: 10, ), Icon( HeroIcons.forward, color: Colors.white70, size: 35, ), SizedBox( width: 20, ), Text( "Exchange", style: TextStyle( color: Colors.white, fontSize: 20), ), ], ), ), const SizedBox( height: 10, ), InkWell( onTap: () { Get.to(() => WithdrawScreen()); }, child: const Row( children: [ SizedBox( width: 10, ), Icon( HeroIcons.banknotes, color: Colors.white70, size: 35, ), SizedBox( width: 20, ), Text( "Withdraw", style: TextStyle( color: Colors.white, fontSize: 20), ), ], ), ), const SizedBox( height: 10, ), InkWell( onTap: () { Get.to(() => TransactionScreen()); }, child: const Row( children: [ SizedBox( width: 10, ), Icon( HeroIcons.bars_arrow_down, color: Colors.white70, size: 35, ), SizedBox( width: 20, ), Text( "Transactions", style: TextStyle( color: Colors.white, fontSize: 20), ), ], ), ), ]), ) : const Text( "", style: TextStyle(fontSize: 0), ), ], ), ), ), const SizedBox( height: 15, ), InkWell( onTap: () { print('I love you'); Get.to(ReferAndEarn()); }, child: GlossyCard( height: 50.0, width: Get.width, borderRadius: 10.0, borderWith: 1.0, child: const Row( children: [ SizedBox( width: 10, ), Icon( HeroIcons.chat_bubble_bottom_center_text, color: Colors.white70, size: 35, ), SizedBox( width: 20, ), Text( "Refer & Earn", style: TextStyle(color: Colors.white, fontSize: 20), ), ], ), ), ), const SizedBox( height: 15, ), InkWell( onTap: () { print('I love you'); Get.to(const Notifications()); }, child: GlossyCard( borderRadius: 10.0, borderWith: 1.0, height: 50.0, width: Get.width, child: const Row( children: [ SizedBox( width: 10, ), Icon( Icons.notifications_rounded, color: Colors.white70, size: 35, ), SizedBox( width: 20, ), Text( "Notifications", style: TextStyle(color: Colors.white, fontSize: 20), ), ], ), ), ), const SizedBox( height: 15, ), InkWell( onTap: () { print('I love you'); Get.to(SupportScreen()); }, child: GlossyCard( borderRadius: 10.0, borderWith: 1.0, height: 50.0, width: Get.width, child: const Row( children: [ SizedBox( width: 10, ), Icon( Icons.headphones, color: Colors.white70, size: 35, ), SizedBox( width: 20, ), Text( "Customer Support", style: TextStyle(color: Colors.white, fontSize: 20), ), ], ), ), ), const SizedBox( height: 15, ), InkWell( onTap: () { print('I love you'); authentication.logOut(); }, child: GlossyCard( borderRadius: 10.0, borderWith: 1.0, height: 50.0, width: Get.width, child: const Row( children: [ SizedBox( width: 10, ), Icon( Icons.logout, color: Colors.white70, size: 35, ), SizedBox( width: 20, ), Text( "Logout", style: TextStyle(color: Colors.white, fontSize: 20), ), ], ), ), ), SizedBox( height: 15, ), ]), ), ) ], ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/app_update/update_screen.dart
import 'package:flutter/material.dart'; import 'package:lottie/lottie.dart'; import 'package:url_launcher/url_launcher.dart'; class UpdateScreen extends StatelessWidget { const UpdateScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: SafeArea( child: Center( child: Container( decoration: const BoxDecoration(color: Colors.transparent), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ SizedBox( height: 300, width: 300, child: LottieBuilder( lottie: AssetLottie("Assets/update_logo.json"), fit: BoxFit.contain, ), ), const Text( "New update is available", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.w600), ), const SizedBox( height: 23, ), InkWell( onTap: () async { var url = Uri.parse("https://www.gamaru.online/"); await launchUrl(url); }, child: Container( height: 50, width: 180, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(25)), child: const Center( child: Text( 'DOWNLOAD NOW', style: TextStyle( color: Colors.green, fontSize: 15, fontWeight: FontWeight.bold), ), ), ), ) ], ), ), ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/watchAndEarn/watchEarn.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/AdController/adController.dart'; import 'package:get/get.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import 'package:lottie/lottie.dart'; class WatchAndEarn extends StatefulWidget { const WatchAndEarn({super.key}); @override State<WatchAndEarn> createState() => _WatchAndEarnState(); } class _WatchAndEarnState extends State<WatchAndEarn> { AdController adController = Get.put(AdController()); final adUnitId = 'ca-app-pub-8716259971846266/3489646966'; RewardedAd? _rewardedAd = null; @override void initState() { print("injksdhskjadhsajkdhsajkdhskjdsakjdh"); super.initState(); RewardedAd.load( adUnitId: adUnitId, request: const AdRequest(), rewardedAdLoadCallback: RewardedAdLoadCallback( // Called when an ad is successfully received. onAdLoaded: (ad) { ad.fullScreenContentCallback = FullScreenContentCallback( // Called when the ad showed the full screen content. onAdShowedFullScreenContent: (ad) {}, // Called when an impression occurs on the ad. onAdImpression: (ad) {}, // Called when the ad failed to show full screen content. onAdFailedToShowFullScreenContent: (ad, err) { // Dispose the ad here to free resources. ad.dispose(); }, // Called when the ad dismissed full screen content. onAdDismissedFullScreenContent: (ad) { // Dispose the ad here to free resources. ad.dispose(); }, // Called when a click is recorded for an ad. onAdClicked: (ad) { print("user click on ad"); adController.updateWinCoins(); }); debugPrint('$ad loaded.'); // Keep a reference to the ad so you can show it later. _rewardedAd = ad; adController.ad_isLoading.value = true; }, // Called when an ad request failed. onAdFailedToLoad: (LoadAdError error) { debugPrint('RewardedAd failed to load: $error'); }, )); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, title: const Text( "Watch and Earn", style: TextStyle(color: Colors.white70, fontWeight: FontWeight.bold), ), iconTheme: const IconThemeData(color: Colors.white70)), body: Container( width: Get.width, child: Column( children: [ Stack( alignment: Alignment.bottomCenter, children: [ Container( height: 230, decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("Assets/wathandEarnPhoto.jpg"))), ), Container( padding: const EdgeInsets.only(bottom: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Container( padding: const EdgeInsets.symmetric( horizontal: 10, vertical: 10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), border: Border.all(color: Colors.yellow, width: 1), color: Colors.black), child: const Text( "HOW TO EARN?", style: TextStyle(color: Colors.white), ), ), Container( padding: const EdgeInsets.symmetric( horizontal: 10, vertical: 10), decoration: BoxDecoration( color: Colors.black, borderRadius: BorderRadius.circular(10), border: Border.all(color: Colors.yellow, width: 1), ), child: const Text( "TERMS & CONDITIONS", style: TextStyle(color: Colors.white), ), ) ], ), ), ], ), const SizedBox( height: 14, ), const Text( "TOTAL EARNING", style: TextStyle( color: Colors.white70, fontSize: 24, fontWeight: FontWeight.bold), ), const SizedBox( height: 4, ), GlossyCard( height: 50.0, width: 100.0, borderRadius: 26.0, borderWith: 2.0, child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ LottieBuilder.asset( "Assets/coin.json", animate: false, fit: BoxFit.cover, height: 22, width: 22, ), const SizedBox( width: 1, ), StreamBuilder( stream: FirebaseFirestore.instance .collection("user") .doc(adController.firebaseUser!.email.toString()) .collection("watchCoinsWin") .doc("watchCoins") .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { return Text( snapshot.data!.data()!["coinsAd"].toString(), style: const TextStyle( color: Colors.yellow, fontSize: 24), ); } return const Text( "00", style: TextStyle(color: Colors.yellow, fontSize: 24), ); }, ) ], ), ], ), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( children: [ const SizedBox( height: 20, ), LottieBuilder.asset( "Assets/adWatch.json", height: 80, width: 80, fit: BoxFit.cover, ), const Text( "WATCH", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold), ) ], ), LottieBuilder.asset( "Assets/rightArrow.json", height: 60, width: 60, fit: BoxFit.cover, ), Column( children: [ const SizedBox( height: 20, ), LottieBuilder.asset( "Assets/coin.json", height: 60, width: 60, fit: BoxFit.cover, frameRate: FrameRate.max, ), const SizedBox( height: 15, ), const Text( "EARN", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold), ) ], ), LottieBuilder.asset( "Assets/rightArrow.json", height: 60, width: 60, fit: BoxFit.cover, ), Column( children: [ const SizedBox( height: 20, ), LottieBuilder.asset( "Assets/play.json", height: 60, width: 60, fit: BoxFit.cover, ), const SizedBox( height: 15, ), const Text( "PLAY", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold), ) ], ), ], ), const SizedBox( height: 30, ), const Text( "Watch more to earn more!", style: TextStyle( color: Colors.white, fontSize: 26, fontWeight: FontWeight.bold), ), const SizedBox( height: 10, ), InkWell( onTap: () { _rewardedAd!.show( onUserEarnedReward: (ad, reward) {}, ); }, child: Container( height: 40, width: 120, padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), decoration: BoxDecoration( color: Colors.black, borderRadius: BorderRadius.circular(10), border: Border.all(color: Colors.yellow, width: 1), ), child: Obx(() => adController.ad_isLoading.value ? const Center( child: Text( "WATCH NOW", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.bold), ), ) : LottieBuilder.asset( "Assets/adlod.json", height: 40, width: 40, ))), ), const SizedBox( height: 20, ), Container( padding: const EdgeInsets.symmetric(horizontal: 8), child: const Column( children: [ Text( "*NOTE - You have to click the install button after finishing the ad to ensure the reward.", style: TextStyle(color: Colors.orange), ), SizedBox( height: 4, ), Text( "*(don't need to install the app just visit it in the play store)", style: TextStyle(color: Colors.orange), ), ], ), ) ], ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/upi_payment_screen.dart
import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Wallet-Controller/walletController.dart'; import 'package:gamaru_mobile_app/Screens/navigation_bar.dart'; import 'package:get/get.dart'; import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:screenshot/screenshot.dart'; import 'package:timer_count_down/timer_count_down.dart'; import 'package:upi_payment_qrcode_generator/upi_payment_qrcode_generator.dart'; class UpiScreen extends StatefulWidget { final String phNo; const UpiScreen({super.key, required this.phNo}); @override State<UpiScreen> createState() => _UpiScreenState(); } class _UpiScreenState extends State<UpiScreen> { ScreenshotController sc = ScreenshotController(); final walletController = Get.put(WalletController()); final fromKey = GlobalKey<FormState>(); UPIDetails? upiDetails; Uint8List? _imageFile; var qr; @override void initState() { // TODO: implement initState upiDetails = UPIDetails( upiID: walletController.upiId.value, payeeName: "Gamaru app", amount: double.parse(walletController.adMoneyController.text), transactionNote: "Recharge for Gamaru", transactionID: "906498347323"); qr = Builder( builder: (context) { return Padding( padding: const EdgeInsets.all(10), child: Center( child: UPIPaymentQRCode( embeddedImagePath: "Assets/gQr.png", embeddedImageSize: Size(Get.width * 0.17, Get.width * 0.17), upiDetails: upiDetails!, size: Get.width * 0.7, ), ), ); }, ); super.initState(); } @override void dispose() { // TODO: implement dispose walletController.refNoController.text = ""; walletController.qrRecharge.value = false; super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: SingleChildScrollView( child: Obx( () => Stack( children: [ SizedBox( height: Get.height * 1.4, child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( height: 50, ), Padding( padding: const EdgeInsets.all(8.0), child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.black12, ), borderRadius: BorderRadius.circular(14)), child: const Padding( padding: EdgeInsets.all(5.0), child: Row( children: [ SizedBox( width: 5, ), Icon( Icons.warning_amber_outlined, size: 45.0, color: Colors.red, ), SizedBox( width: 5, ), Column( children: [ Text( 'Do not exit this page until payment is', style: TextStyle( fontSize: 17, color: Colors.orange, fontWeight: FontWeight.w700), ), Text( 'done.', style: TextStyle( fontSize: 17, color: Colors.orange, fontWeight: FontWeight.w700), ), ], ) ], ), ), ), ), Countdown( seconds: 600, build: (BuildContext context, double time) => Text( "${(time / 60).toInt()} Min ${(time % 60).toInt()} Sec", style: const TextStyle( fontSize: 20, fontWeight: FontWeight.w800), ), interval: const Duration(seconds: 1), onFinished: () { Get.off(MainScreen()); }, ), qr, // Screenshot( // controller: sc, // child: Padding( // padding: const EdgeInsets.all(10), // child: Center( // child: UPIPaymentQRCode( // // embeddedImagePath: "Assets/gQr.png", // // embeddedImageSize: // // Size(Get.width * 0.17, Get.width * 0.17), // upiDetails: upiDetails!, // size: Get.width * 0.7, // ), // ), // ), // ), const Padding( padding: EdgeInsets.only(top: 10.0), child: Text( 'Scan to pay with UPI apps', style: TextStyle(fontWeight: FontWeight.w600, fontSize: 19), ), ), const Padding( padding: EdgeInsets.only(top: 5.0), child: Text( 'or', style: TextStyle(fontWeight: FontWeight.w600, fontSize: 19), ), ), Padding( padding: const EdgeInsets.only(top: 10), child: SizedBox( height: 50, width: 200, child: FloatingActionButton( onPressed: () async { sc .captureFromLongWidget( InheritedTheme.captureAll( context, Material( child: qr, ), ), delay: Duration(milliseconds: 100), context: context, /// /// Additionally you can define constraint for your image. /// /// constraints: BoxConstraints( /// maxHeight: 1000, /// maxWidth: 1000, /// ) ) .then((capturedImage) async { // Handle captured image _imageFile = capturedImage; // Request permission to write to external storage // print("hiiii"); var status = await Permission.manageExternalStorage .request(); if (status != PermissionStatus.granted) { // Permission denied print("hiiii"); return; } // Save image to gallery final result = await ImageGallerySaver.saveImage(_imageFile!); print(result); if (result["isSuccess"]) { Get.snackbar("Photo Saved to Gallery", "Open your payment app and complete the payment"); } // Result is a boolean indicating whether the operati }); // sc.capture().then((value) async { // _imageFile = value; // // Request permission to write to external storage // // print("hiiii"); // var status = // await Permission.manageExternalStorage.request(); // if (status != PermissionStatus.granted) { // // Permission denied // print("hiiii"); // return; // } // // Save image to gallery // final result = // await ImageGallerySaver.saveImage(_imageFile!); // print( // result); // Result is a boolean indicating whether the operati // }); }, child: const Text( 'Download QR code', style: TextStyle( fontSize: 17, fontWeight: FontWeight.w500, letterSpacing: 1.0), ), ), ), ), const Padding( padding: EdgeInsets.only(left: 20, right: 20, top: 10), child: Text( "then", style: TextStyle(fontWeight: FontWeight.w600, fontSize: 19), ), ), Padding( padding: const EdgeInsets.only( top: 20.0, left: 50, right: 50, bottom: 5), child: GlossyCard( borderRadius: 8.0, borderWith: 1.0, height: 60.0, width: Get.width * 0.8, child: Container( decoration: BoxDecoration( color: Colors.transparent, borderRadius: BorderRadius.circular(0), ), child: Form( key: fromKey, child: TextFormField( controller: walletController.refNoController, validator: (value) { if (value!.isEmpty) { return "Please Enter your transaction Id"; } else { return null; } }, keyboardType: TextInputType.number, style: const TextStyle( color: Colors.black87, decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.bold), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter UPI transaction ID", hintStyle: TextStyle( color: Colors.black87, fontSize: 16), prefixIcon: Icon( Icons.arrow_circle_right_rounded, color: Colors.black87, size: 28, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide( color: Colors.black87, )), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ), ), ), ), Padding( padding: const EdgeInsets.only(top: 30), child: SizedBox( height: 50, width: 150, child: FloatingActionButton( onPressed: () { final from = fromKey.currentState!; if (from.validate()) { print("hiii"); walletController.qrRecharge.value = true; int amount = int.parse( walletController.adMoneyController.text); walletController.paymentSuccess(amount); walletController.saveToAllRecharge( walletController.refNoController.text, amount, widget.phNo); } }, backgroundColor: Colors.green, child: const Text( 'SUBMIT', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, letterSpacing: 2.0), ), ), ), ), SizedBox( height: Get.height * .05, ), ], ), ), walletController.qrRecharge.value ? Container( decoration: const BoxDecoration( color: Color.fromARGB(149, 0, 0, 0)), height: Get.height * 1.4, width: Get.width, child: const Center( child: SizedBox( height: 50, width: 50, child: CircularProgressIndicator()), ), ) : const SizedBox(), ], ), )), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/bankCard.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/addBankCard.dart'; import 'package:get/get.dart'; class BankCard extends StatelessWidget { const BankCard({super.key}); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: AppBar( iconTheme: IconThemeData(color: Colors.white), backgroundColor: Colors.black, title: Text( "BANK CARDS", style: TextStyle(color: Colors.white), )), body: Center( child: Column( children: [ Container( height: Get.height * 0.5, ), InkWell( onTap: () { Get.to(() => AddBankCard()); }, child: Icon( Icons.add_box_rounded, color: Colors.white, size: 50, ), ), Text( "ADD NEW BANK CARD", style: TextStyle(color: Colors.white), ), ], )), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/addBankCard.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Controllers/Wallet-Controller/walletController.dart'; import 'package:get/get.dart'; class AddBankCard extends StatelessWidget { const AddBankCard({super.key}); @override Widget build(BuildContext context) { final fromKey = GlobalKey<FormState>(); final walletController = Get.put(WalletController()); return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.black, appBar: AppBar( iconTheme: IconThemeData(color: Colors.white), backgroundColor: Colors.black, title: const Text( "ADD BANK CARD", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), )), body: ListView( children: [ const Text( " Please fill all the information correctly", style: TextStyle(color: Colors.red), ), Center( child: Column( children: [ Padding( padding: const EdgeInsets.all(20.0), child: Form( key: fromKey, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( " Enter your Account number or UPI id *", style: TextStyle(color: Colors.white70, fontSize: 16), ), SizedBox( height: 5, ), TextFormField( controller: walletController.accountNoController, validator: (value) { if (value!.isEmpty) { return "Please Enter your Account No/UPI"; } else { return null; } }, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter your Account NO/UPI", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.payment_rounded, color: Colors.white60, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), const SizedBox( height: 15, ), const Text( " Enter the Name of the Bank *", style: TextStyle(color: Colors.white70, fontSize: 16), ), const SizedBox( height: 5, ), TextFormField( controller: walletController.bankNameController, validator: (value) { if (value!.isEmpty) { return "Please Enter your Bank Name"; } else { return null; } }, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter your Bank Name", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.home_rounded, color: Colors.white60, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), const SizedBox( height: 15, ), Text( " Enter your Name as per Bank Account *", style: TextStyle(color: Colors.white70, fontSize: 16), ), SizedBox( height: 5, ), TextFormField( controller: walletController.nameController, validator: (value) { if (value!.isEmpty) { return "Please Enter your Name"; } else { return null; } }, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter your Name", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.person, color: Colors.white60, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), const SizedBox( height: 15, ), Text( " Enter your Phone No *", style: TextStyle(color: Colors.white70, fontSize: 16), ), SizedBox( height: 5, ), TextFormField( controller: walletController.phoneNoController, keyboardType: TextInputType.number, validator: (value) { if (value!.isEmpty) { return "Please Enter yoour phone number"; } else if (value.length < 10) { return "Enter a Valid Phone Number"; } else { return null; } }, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter your Phone No", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.phone_android_rounded, color: Colors.white60, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), const SizedBox( height: 15, ), Text( " Enter IFSC Code *", style: TextStyle(color: Colors.white70, fontSize: 16), ), SizedBox( height: 5, ), TextFormField( controller: walletController.ifscCodeController, validator: (value) { if (value!.isEmpty) { return "Please Enter your IFSC Code"; } else { return null; } }, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter IFSC Code", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.card_giftcard, color: Colors.white60, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), const SizedBox( height: 15, ), Text( " Enter your Address *", style: TextStyle(color: Colors.white70, fontSize: 16), ), SizedBox( height: 5, ), TextFormField( controller: walletController.addressController, validator: (value) { if (value!.isEmpty) { return "Please Enter your Address"; } else { return null; } }, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter your Address", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.location_city, color: Colors.white60, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), const SizedBox( height: 15, ), const SizedBox( height: 15, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: BorderSide( color: Colors.green))), backgroundColor: MaterialStatePropertyAll(Colors.green)), onPressed: () { final from = fromKey.currentState!; if (from.validate()) { walletController.addBankCard( walletController .accountNoController.text, walletController .bankNameController.text, walletController.nameController.text, walletController.phoneNoController.text, walletController .ifscCodeController.text, walletController .ifscCodeController.text); } }, child: const Text( "SUBMIT", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), )), ], ), SizedBox( height: 400, ) ], )), ) ], )), ], ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/RechargeFailed.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/navigation_bar.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import '../../Componants/glossyEffect.dart'; class RechargeFailed extends StatelessWidget { const RechargeFailed({super.key}); @override Widget build(BuildContext context) { return Dialog( backgroundColor: Colors.transparent, insetAnimationCurve: Curves.bounceIn, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular( 25, ), ), ), alignment: Alignment.center, child: GlossyCard( height: Get.height * .45, width: Get.width * .2, borderRadius: 20.0, borderWith: 0.5, child: Stack( children: [ Container( decoration: const BoxDecoration(color: Colors.transparent), child: Padding( padding: const EdgeInsets.only(bottom: 15.0, left: 15, right: 15), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( height: 150, width: 150, child: LottieBuilder.asset( "Assets/PaymentFailed.json", fit: BoxFit.cover, ), ), const Padding( padding: EdgeInsets.only(top: 0.0, bottom: 8.0), child: Text( "Payment Failed!", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 20), ), ), const Text( "Your transaction is failed.", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700), ), const Text( " please try again", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700), ), // const Text( // "shortly.", // style: TextStyle( // color: Colors.white70, fontWeight: FontWeight.w700), // ), const SizedBox( height: 20, ), InkWell( highlightColor: Colors.black, onTap: () => Get.offAll(MainScreen()), child: Container( height: Get.height * .045, width: Get.width * .35, decoration: BoxDecoration( borderRadius: BorderRadius.circular(25), boxShadow: const [ BoxShadow( color: Colors.white, blurStyle: BlurStyle.outer, blurRadius: 0.04, spreadRadius: 0.9, ), ], gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Color.fromARGB(255, 53, 25, 109), Color.fromARGB(255, 73, 22, 82) ]), ), child: const Center( child: Text( "Ok", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.w400), ), ), ), ), ], ), ), ), ], ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/withdrawl.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Wallet-Controller/walletController.dart'; import 'package:gamaru_mobile_app/Screens/Customer%20Support/SupportScreen.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/addBankCard.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/bankCard.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import 'withdrawComplete.dart'; import 'withdrawFaild.dart'; class WithdrawScreen extends StatefulWidget { const WithdrawScreen({super.key}); @override State<WithdrawScreen> createState() => _WithdrawScreenState(); } class _WithdrawScreenState extends State<WithdrawScreen> { final fromKey = GlobalKey<FormState>(); final walletController = Get.put(WalletController()); @override void initState() { super.initState(); walletController.getBankCardList(); } @override Widget build(BuildContext context) { walletController.withdrawMoneyController.text = ""; walletController.fee.value = "0"; walletController.toAccount.value = "0"; walletController.bankCardDetails = null; int balance = 0; return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.black, appBar: AppBar( actions: [ InkWell( onTap: () { Get.to(() => BankCard()); }, child: Icon( Icons.account_balance_wallet_rounded, size: 30, )), SizedBox( width: 15, ) ], backgroundColor: Colors.black, iconTheme: IconThemeData(color: Colors.white), title: const Text( "WITHDRAWAL", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), )), body: Stack( children: [ SizedBox( width: Get.width, child: Column(children: [ SizedBox( height: 50, ), Container( height: 48, width: 250, padding: const EdgeInsets.symmetric( horizontal: 10, ), decoration: BoxDecoration( color: Color.fromARGB(255, 78, 78, 78).withOpacity(0.9), borderRadius: BorderRadius.circular(15)), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Balance - ", style: TextStyle(color: Colors.white, fontSize: 24), ), LottieBuilder.asset( "Assets/winning_coin.json", height: 30, width: 20, frameRate: FrameRate.max, ), const SizedBox( width: 2, ), StreamBuilder( stream: FirebaseFirestore.instance .collection("user") .doc(FirebaseAuth.instance.currentUser!.email .toString()) .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { int coins = snapshot!.data!.data()!["winCoins"]; balance = coins; return Text( coins.toString(), style: TextStyle(color: Colors.yellow, fontSize: 20), ); } else { balance = 0; return Text("0"); } }, ) ], ), ), ), SizedBox( height: 40, ), Form( key: fromKey, child: Container( padding: EdgeInsets.symmetric(horizontal: 30), child: TextFormField( onChanged: (value) { walletController.fee.value = ((double.parse( walletController .withdrawMoneyController.text) * 0.10) .floor()) .toString(); walletController.toAccount.value = ((double.parse(value) - double.parse(walletController.fee.value)) .floor()) .toString(); }, controller: walletController.withdrawMoneyController, validator: (value) { if (value!.isEmpty) { return "Please Enter some Amount"; } else if (int.parse(value) < 100) { return "Minimum Withdraw Amount is 100"; } }, keyboardType: TextInputType.number, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none, fontSize: 24, fontWeight: FontWeight.bold), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter the amount", hintStyle: TextStyle(color: Colors.white60, fontSize: 24), prefixIcon: Icon( Icons.currency_rupee_rounded, color: Colors.white60, size: 28, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(5)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(5)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(5)), borderSide: BorderSide(color: Colors.purple)), ), ), ), ), SizedBox( height: 10, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 35), child: Row( children: [ Obx( () => Text( "Fee : ₹" + walletController.fee.value + " , To Account : ₹" + walletController.toAccount.value, style: TextStyle( color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold), ), ) ], ), ), SizedBox( height: 30, ), Obx( () => Container( child: DropdownMenu( onSelected: (value) { if (value == "") { Get.to(() => AddBankCard()); } else { walletController.bankCardDetails = value; } }, hintText: "Select your Bank Card", menuStyle: MenuStyle( backgroundColor: MaterialStatePropertyAll( Color.fromARGB(255, 33, 7, 78))), label: Text( "Select your Bank card", style: TextStyle(color: Colors.white), ), leadingIcon: Icon( Icons.payment_rounded, color: Colors.white70, ), textStyle: TextStyle(color: Colors.white), width: Get.width - 60, dropdownMenuEntries: [ ...walletController.bankCardList.value.map((ele) { return DropdownMenuEntry( style: ButtonStyle( foregroundColor: MaterialStatePropertyAll(Colors.white)), value: ele, label: ele["bankName"] + " , " + ele["accNoorUpi"].toString().substring(0, 4) + "...", leadingIcon: Icon( Icons.credit_card_outlined, color: Colors.white70, ), ); }).toList(), DropdownMenuEntry( style: ButtonStyle( foregroundColor: MaterialStatePropertyAll(Colors.white)), value: "", label: "Add new Bank Card", leadingIcon: Icon( Icons.add_card, color: Colors.white70, ), ) ], ), ), ), Container( padding: EdgeInsets.symmetric(horizontal: 30), child: Column(children: [ const SizedBox( height: 50, ), ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all<RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: BorderSide(color: Colors.green))), backgroundColor: MaterialStatePropertyAll(Colors.green)), onPressed: () { final from = fromKey.currentState!; if (from.validate()) { if (walletController.bankCardDetails == null) { Get.snackbar("Error", "Select a Bank Card", colorText: Colors.red); } else if (int.parse( walletController.withdrawMoneyController.text) > balance) { Get.snackbar( "Error", "Doesn't have sufficient balance", colorText: Colors.red); } else { int amount = double.parse( walletController.withdrawMoneyController.text) .floor(); int fee = double.parse(walletController.fee.value).floor(); walletController.withdrawAmount( amount, walletController.bankCardDetails, fee); print("hiiii"); } } }, child: const Text( "Withdraw", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), ), ), const SizedBox( height: 20, ), const SizedBox( height: 20, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Facing issue?", style: TextStyle(color: Colors.white, fontSize: 18), ), const SizedBox( width: 15, ), InkWell( onTap: () { Get.to(() => SupportScreen()); }, child: const Text( "Contact Us", style: TextStyle( color: Colors.blue, fontSize: 18, fontWeight: FontWeight.bold, decoration: TextDecoration.underline, decorationColor: Colors.blue, ), ), ) ], ) ]), ) ]), ), Obx( () => walletController.is_withdrawing.value ? Container( color: const Color.fromARGB(39, 158, 158, 158), height: Get.height, width: Get.width, child: Center( child: LottieBuilder.asset( "Assets/money_shower.json", frameRate: FrameRate.max, ), ), ) : const Text(""), ), ], ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/RechargeDone.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/navigation_bar.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import '../../Componants/glossyEffect.dart'; class RechargeDone extends StatelessWidget { const RechargeDone({super.key}); @override Widget build(BuildContext context) { return Dialog( backgroundColor: Colors.transparent, insetAnimationCurve: Curves.bounceIn, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular( 25, ), ), ), alignment: Alignment.center, child: GlossyCard( height: Get.height * .45, width: Get.width * .2, borderRadius: 20.0, borderWith: 0.5, child: Stack( children: [ Container( decoration: const BoxDecoration(color: Colors.transparent), child: Padding( padding: const EdgeInsets.only(bottom: 15.0, left: 15, right: 15), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( height: 150, width: 150, child: LottieBuilder.asset( "Assets/PaymentDone.json", fit: BoxFit.cover, ), ), const Padding( padding: EdgeInsets.only(top: 0.0, bottom: 8.0), child: Text( "Payment done!", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 20), ), ), const Text( "Your transaction is successful.Money", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700), ), const Text( " will be creadited to your account", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700), ), const Text( "shortly.", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700), ), SizedBox( height: 20, ), InkWell( highlightColor: Colors.black, onTap: () => Get.offAll(MainScreen()), child: Container( height: Get.height * .045, width: Get.width * .35, decoration: BoxDecoration( borderRadius: BorderRadius.circular(25), boxShadow: const [ BoxShadow( color: Colors.white, blurStyle: BlurStyle.outer, blurRadius: 0.04, spreadRadius: 0.9, ), ], gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Color.fromARGB(255, 53, 25, 109), Color.fromARGB(255, 73, 22, 82) ]), ), child: const Center( child: Text( "Ok", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.w400), ), ), ), ), ], ), ), ), ], ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/addMoney.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Main-Controller/mainController.dart'; import 'package:gamaru_mobile_app/Controllers/Wallet-Controller/walletController.dart'; import 'package:gamaru_mobile_app/Screens/Customer%20Support/SupportScreen.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import 'package:url_launcher/url_launcher.dart'; // import 'package:razorpay_flutter/razorpay_flutter.dart'; import 'RechargeDone.dart'; import 'RechargeFailed.dart'; class AddMoney extends StatefulWidget { const AddMoney({super.key}); @override State<AddMoney> createState() => _AddMoneyState(); } class _AddMoneyState extends State<AddMoney> { // final _razorpay = Razorpay(); final fromKey = GlobalKey<FormState>(); final walletController = Get.put(WalletController()); @override void initState() { super.initState(); } @override Widget build(BuildContext context) { walletController.adMoneyController.text = ""; return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, iconTheme: const IconThemeData(color: Colors.white), title: InkWell( onTap: () => Get.to(RechargeFailed()), child: const Text( "RECHARGE", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), ), )), body: SingleChildScrollView( child: SizedBox( width: Get.width, child: Column(children: [ const SizedBox( height: 20, ), Container( height: 48, width: 250, padding: const EdgeInsets.symmetric( horizontal: 10, ), decoration: BoxDecoration( color: const Color.fromARGB(255, 78, 78, 78).withOpacity(0.9), borderRadius: BorderRadius.circular(15)), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Balance - ", style: TextStyle(color: Colors.white, fontSize: 24), ), LottieBuilder.asset( "Assets/coin.json", height: 30, width: 20, frameRate: FrameRate.max, ), const SizedBox( width: 2, ), StreamBuilder( stream: FirebaseFirestore.instance .collection("user") .doc(FirebaseAuth.instance.currentUser!.email .toString()) .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { int coins = snapshot!.data!.data()!["coins"]; return Text( coins.toString(), style: const TextStyle( color: Colors.yellow, fontSize: 20), ); } else { return const Text("0"); } }, ) ], ), ), ), const SizedBox( height: 40, ), Form( key: fromKey, child: Container( padding: EdgeInsets.symmetric(horizontal: 30), child: Column( children: [ TextFormField( controller: walletController.adMoneyController, validator: (value) { if (value!.isEmpty) { return "Please Enter some Amount"; } else { return null; } }, keyboardType: TextInputType.number, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none, fontSize: 24, fontWeight: FontWeight.bold), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter the amount", hintStyle: TextStyle(color: Colors.white60, fontSize: 24), prefixIcon: Icon( Icons.currency_rupee_rounded, color: Colors.white60, size: 28, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), SizedBox( height: 10, ), TextFormField( controller: walletController.rechargeNoController, validator: (value) { if (value!.isEmpty) { return "Please Enter your Number"; } else if (value.length < 10) { return "Invalid Number"; } else if (value.length > 10) { return "Invalid Number"; } else { return null; } }, keyboardType: TextInputType.number, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none, fontSize: 24, fontWeight: FontWeight.bold), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter Phone Number", hintStyle: TextStyle(color: Colors.white60, fontSize: 24), prefixIcon: Icon( Icons.phone_android_rounded, color: Colors.white60, size: 28, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ], ), ), ), const SizedBox( height: 30, ), Container( padding: const EdgeInsets.symmetric(horizontal: 30), child: Column(children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ InkWell( onTap: () { walletController.adMoneyController.text = "10"; }, child: const GlossyCard( height: 50.0, width: 100.0, borderRadius: 10.0, borderWith: 2.0, child: Text( "₹10", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), )), ), InkWell( onTap: () { walletController.adMoneyController.text = "20"; }, child: const GlossyCard( height: 50.0, width: 100.0, borderRadius: 10.0, borderWith: 2.0, child: Text( "₹20", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), )), ), InkWell( onTap: () { walletController.adMoneyController.text = "30"; }, child: const GlossyCard( height: 50.0, width: 100.0, borderRadius: 10.0, borderWith: 2.0, child: Text( "₹30", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), )), ), ], ), const SizedBox( height: 30, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ InkWell( onTap: () { walletController.adMoneyController.text = "50"; }, child: const GlossyCard( height: 50.0, width: 100.0, borderRadius: 10.0, borderWith: 2.0, child: Text( "₹50", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), )), ), InkWell( onTap: () { walletController.adMoneyController.text = "100"; }, child: const GlossyCard( height: 50.0, width: 100.0, borderRadius: 10.0, borderWith: 2.0, child: Text( "₹100", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), )), ), InkWell( onTap: () { walletController.adMoneyController.text = "200"; }, child: const GlossyCard( height: 50.0, width: 100.0, borderRadius: 10.0, borderWith: 2.0, child: Text( "₹200", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), )), ), ], ), const SizedBox( height: 30, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ InkWell( onTap: () { walletController.adMoneyController.text = "400"; }, child: const GlossyCard( height: 50.0, width: 100.0, borderRadius: 10.0, borderWith: 2.0, child: Text( "₹400", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), )), ), InkWell( onTap: () { walletController.adMoneyController.text = "500"; }, child: const GlossyCard( height: 50.0, width: 100.0, borderRadius: 10.0, borderWith: 2.0, child: Text( "₹500", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), )), ), InkWell( onTap: () { walletController.adMoneyController.text = "1000"; }, child: const GlossyCard( height: 50.0, width: 100.0, borderRadius: 10.0, borderWith: 2.0, child: Text( "₹1000", style: TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), )), ), ], ), const SizedBox( height: 40, ), ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all<RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: BorderSide(color: Colors.green))), backgroundColor: MaterialStatePropertyAll(Colors.green)), onPressed: () async { final from = fromKey.currentState!; if (from.validate()) { walletController .getUpiId(walletController.phoneNoController.text); } }, child: Text( "Recharge Now", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), ), ), const SizedBox( height: 20, ), const SizedBox( height: 10, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Facing issue?", style: TextStyle(color: Colors.white, fontSize: 18), ), const SizedBox( width: 15, ), InkWell( onTap: () { Get.to(() => const SupportScreen()); }, child: const Text( "Contact Us", style: TextStyle( color: Colors.blue, fontSize: 18, fontWeight: FontWeight.bold, decoration: TextDecoration.underline, decorationColor: Colors.blue, ), ), ), ], ), const SizedBox( width: 10, ), const Text( "or", style: TextStyle(color: Colors.white, fontSize: 18), ), const SizedBox( width: 10, ), InkWell( onTap: () async { var url = Uri.parse( "${MainController.instance.urls["howToRecharge"]}"); await launchUrl(url); }, child: const Text( "Watch Video", style: TextStyle( color: Colors.cyan, fontSize: 18, fontWeight: FontWeight.bold, decoration: TextDecoration.underline, decorationColor: Colors.cyan, ), ), ) ]), ) ]), ), ), ); } } // void _handlePaymentSuccess(PaymentSuccessResponse response) { // // Do something when payment succeeds // WalletController.instance.paymentSuccess( // int.parse(WalletController.instance.adMoneyController.text)); // } // void _handlePaymentError(PaymentFailureResponse response) { // Get.to(const RechargeFailed()); // // Do something when payment fails // } // void _handleExternalWallet(ExternalWalletResponse response) { // // Do something when an external wallet was selected // }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/withdrawComplete.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/navigation_bar.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import '../../Componants/glossyEffect.dart'; class WithdrawComplete extends StatelessWidget { const WithdrawComplete({super.key}); @override Widget build(BuildContext context) { return Dialog( backgroundColor: Colors.transparent, insetAnimationCurve: Curves.bounceIn, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular( 25, ), ), ), alignment: Alignment.center, child: GlossyCard( height: Get.height * .45, width: Get.width * .2, borderRadius: 20.0, borderWith: 0.5, child: Stack( children: [ Container( decoration: const BoxDecoration(color: Colors.transparent), child: Padding( padding: const EdgeInsets.all(15.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( height: 100, width: 100, child: LottieBuilder.asset( "Assets/Successfully.json", fit: BoxFit.cover, ), ), const Padding( padding: EdgeInsets.only(top: 8.0, bottom: 8.0), child: Text( "S U C C E S S !", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 20), ), ), const Text( "Your Withdraw is successful and your payment will be credited soon to your bank account", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700), ), SizedBox( height: Get.height * 0.04, ), InkWell( highlightColor: Colors.black, onTap: () => Get.offAll(MainScreen()), child: Container( height: Get.height * .045, width: Get.width * .35, decoration: BoxDecoration( borderRadius: BorderRadius.circular(25), boxShadow: const [ BoxShadow( color: Colors.white, blurStyle: BlurStyle.outer, blurRadius: 0.04, spreadRadius: 0.9, ), ], gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Color.fromARGB(255, 53, 25, 109), Color.fromARGB(255, 73, 22, 82) ]), ), child: const Center( child: Text( "Ok", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.w400), ), ), ), ), ], ), ), ), ], ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/withdrawFaild.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/navigation_bar.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import '../../Componants/glossyEffect.dart'; class WithdrawFailed extends StatelessWidget { const WithdrawFailed({super.key}); @override Widget build(BuildContext context) { return Dialog( backgroundColor: Colors.transparent, insetAnimationCurve: Curves.bounceIn, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular( 25, ), ), ), alignment: Alignment.center, child: GlossyCard( height: Get.height * .45, width: Get.width * .2, borderRadius: 20.0, borderWith: 0.5, child: Stack( children: [ Container( decoration: const BoxDecoration(color: Colors.transparent), child: Padding( padding: const EdgeInsets.all(15.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( height: 100, width: 100, child: LottieBuilder.asset( "Assets/Failed.json", fit: BoxFit.cover, ), ), const Padding( padding: EdgeInsets.only(top: 8.0, bottom: 8.0), child: Text( "Sorry, Payment failed !", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 20), ), ), const Text( "Payment was unsuccessfull due to", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700), ), const Text( "some abnormality. Please try again", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700), ), const Text( "later or use another method", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700), ), SizedBox( height: Get.height * 0.02, ), InkWell( highlightColor: Colors.black, onTap: () => Get.offAll(MainScreen()), child: Container( height: Get.height * .045, width: Get.width * .35, decoration: BoxDecoration( borderRadius: BorderRadius.circular(25), boxShadow: const [ BoxShadow( color: Colors.white, blurStyle: BlurStyle.outer, blurRadius: 0.04, spreadRadius: 0.9, ), ], gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Color.fromARGB(255, 53, 25, 109), Color.fromARGB(255, 73, 22, 82) ]), ), child: const Center( child: Text( "Ok", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.w400), ), ), ), ), // Padding( // padding: const EdgeInsets.all(8.0), // child: InkWell( // highlightColor: Colors.black, // onTap: () { // Get.to(HomeScreen()); // }, // child: const Row( // mainAxisAlignment: MainAxisAlignment.center, // children: [ // Icon( // Icons.arrow_back_outlined, // color: Colors.white60, // ), // Text( // " Back to Homescreen", // style: TextStyle(color: Colors.white60), // ), // ], // ), // ), // ), ], ), ), ), ], ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Wallet-Screens/transaction-screen.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; import 'package:lottie/lottie.dart'; class TransactionScreen extends StatefulWidget { const TransactionScreen({super.key}); @override State<TransactionScreen> createState() => _TransactionScreenState(); } class _TransactionScreenState extends State<TransactionScreen> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, title: Text( "TRANSACTIONS", style: TextStyle(color: Colors.white), ), iconTheme: IconThemeData(color: Colors.white), ), body: Container( height: Get.height, width: Get.width, child: StreamBuilder( stream: FirebaseFirestore.instance .collection("user transactions") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { List l = snapshot.data!.data()!["transactions"]; if (l.isEmpty) { return Center( child: Column( children: [ SizedBox( height: Get.height * 0.26, ), LottieBuilder.asset( "Assets/NoData.json", height: 200, width: 300, ), Text( "No Transaction yet!", style: TextStyle(color: Colors.white, fontSize: 20), ), ], ), ); } else { return ListView( children: l.map((e) { Timestamp t = e["time"]; DateTime dt = t.toDate(); return Column( children: [ SizedBox( height: 20, ), GlossyCard( height: 80.0, width: Get.width, borderRadius: 10.0, borderWith: 2.0, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( e["reason"].toString(), style: const TextStyle( color: Colors.white60, fontSize: 20, fontWeight: FontWeight.bold), ), Text( DateFormat.yMMMEd() .add_jm() .format(dt), style: const TextStyle( color: Colors.white60), ) ], ), Row( children: [ Text( e["add"] ? "+" : "-", style: TextStyle( color: Colors.white, fontSize: 30), ), SizedBox( width: 4, ), e["reason"] == "Withdraw" || e["reason"] == "Winning" ? LottieBuilder.asset( "Assets/winning_coin.json", animate: false, ) : LottieBuilder.asset( "Assets/coin.json", animate: false, ), const SizedBox( width: 3, ), Text( (e["amount"] + e["fee"]).toString(), style: const TextStyle( color: Colors.white70, fontSize: 20, fontWeight: FontWeight.bold), ) ], ) ]), )), ], ); }).toList(), ); } } else { return SizedBox( height: 100, width: 100, child: CircularProgressIndicator()); } }, )), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Top-section-every/top-part.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/addMoney.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/withdrawl.dart'; import 'package:gamaru_mobile_app/Screens/notifications-screen/notification.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; class TopDetails extends StatelessWidget { const TopDetails({super.key}); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.only(top: 5, left: 10, right: 10), child: Column( children: [ SizedBox( width: Get.width, height: 40, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( height: 40, width: 125, decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("Assets/gamaru_text.png")))), SizedBox( width: Get.width * 0.02, ), InkWell( onTap: () { Get.to(WithdrawScreen()); }, child: Container( height: 28, padding: const EdgeInsets.symmetric( horizontal: 10, ), decoration: BoxDecoration( color: const Color.fromARGB(255, 78, 78, 78) .withOpacity(0.9), borderRadius: BorderRadius.circular(15)), child: Center( child: Row( children: [ LottieBuilder.asset( "Assets/winning_coin.json", frameRate: FrameRate.max, ), const SizedBox( width: 2, ), StreamBuilder( stream: FirebaseFirestore.instance .collection("user") .doc(FirebaseAuth.instance.currentUser!.email .toString()) .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { int coins = snapshot.data!.data()!["winCoins"]; return Text( coins.toString(), style: const TextStyle( color: Colors.yellow, ), ); } else { return const Text("0"); } }, ) ], ), ), ), ), InkWell( onTap: () { Get.to(AddMoney()); }, child: Container( height: 28, padding: const EdgeInsets.symmetric( horizontal: 10, ), decoration: BoxDecoration( color: const Color.fromARGB(255, 78, 78, 78) .withOpacity(0.9), borderRadius: BorderRadius.circular(15)), child: Center( child: Row( children: [ LottieBuilder.asset( "Assets/coin.json", frameRate: FrameRate.max, ), const SizedBox( width: 2, ), StreamBuilder( stream: FirebaseFirestore.instance .collection("user") .doc(FirebaseAuth.instance.currentUser!.email .toString()) .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { int coins = snapshot.data!.data()!["coins"]; return Text( coins.toString(), style: const TextStyle( color: Colors.yellow, ), ); } else { return const Text("0"); } }, ), const SizedBox( width: 5, ), const Icon( Icons.add, size: 20, color: Colors.green, ), ], ), ), ), ), InkWell( onTap: () { Get.to(() => Notifications()); }, child: const Icon( Icons.notifications_none_rounded, color: Colors.white, size: 26, ), ), ], )) ], ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Join-now/joinNow-duo.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Event-controller/eventController.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; bool isChecked = false; class JoinNowDuo extends StatefulWidget { final String eventName; final int entryFee; final int index; final DateTime dt; const JoinNowDuo( {super.key, required this.entryFee, required this.index, required this.dt, required this.eventName}); @override State<JoinNowDuo> createState() => _JoinNowDuoState(); } class _JoinNowDuoState extends State<JoinNowDuo> { final eventController = Get.put(EventController()); final fromKey = GlobalKey<FormState>(); @override void initState() { super.initState(); eventController.getBgmiId(); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, iconTheme: const IconThemeData(color: Colors.white), title: const Text( "JOIN NOW", style: TextStyle(color: Colors.white), ), ), body: Stack( children: [ SizedBox( height: Get.height, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 200, child: Center( child: LottieBuilder.asset( "Assets/duoJoin.json", frameRate: FrameRate.max, ), ), ), const SizedBox( height: 10, ), GlossyCard( height: Get.height * .37, width: Get.width - 30.0, borderRadius: 10.0, borderWith: 2.0, child: Form( key: fromKey, child: Column( children: [ Padding( padding: const EdgeInsets.only( left: 15, right: 15, top: 20, bottom: 0), child: TextFormField( validator: (value) => validateID(value), controller: eventController.player1, keyboardType: TextInputType.text, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "ENTER PLAYER-1 GAME ID NAME", hintStyle: TextStyle( color: Colors.white60, fontSize: 15), prefixIcon: Icon( Icons.tag_rounded, color: Colors.white60, ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ), Padding( padding: const EdgeInsets.only( left: 15, right: 15, top: 20, bottom: 0), child: TextFormField( validator: (value) => validateID(value), controller: eventController.player2, keyboardType: TextInputType.text, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "ENTER PLAYER-2 GAME ID NAME", hintStyle: TextStyle( color: Colors.white60, fontSize: 15), prefixIcon: Icon( Icons.tag_rounded, color: Colors.white60, ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ), Padding( padding: const EdgeInsets.symmetric( horizontal: 12, vertical: 0), child: Row( children: [ Checkbox( checkColor: Colors.white, value: isChecked, onChanged: (bool? value) { setState(() { isChecked = value!; }); }, ), const Text( "SAVE FOR FURTHER USE", style: TextStyle(color: Colors.white), ) ], ), ), const SizedBox( height: 5, ), ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: const BorderSide( color: Colors.green))), backgroundColor: const MaterialStatePropertyAll( Colors.green), foregroundColor: const MaterialStatePropertyAll( Colors.white), ), onPressed: () { final from = fromKey.currentState!; if (from.validate()) { if (isChecked) { eventController.updateBgmiId( eventController.player1.text, eventController.player2.text, eventController.player3.text, eventController.player4.text); } if (widget.eventName.contains("BGMI")) { eventController.joinBgmi( widget.index, widget.dt, widget.entryFee, "duo", eventController.player1.text, eventController.player2.text, eventController.player3.text, eventController.player4.text); } else if (widget.eventName .contains("FREE FIRE")) { eventController.joinFreeFire( widget.index, widget.dt, widget.entryFee, "duo", eventController.player1.text, eventController.player2.text, eventController.player3.text, eventController.player4.text); } } }, child: SizedBox( width: 130, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text("JOIN NOW ("), LottieBuilder.asset( "Assets/coin.json", animate: false, ), Text( widget.entryFee.toString(), style: const TextStyle( color: Color.fromARGB( 255, 255, 234, 45)), ), const Text(")") ], ), )) ], ), ), ), const SizedBox( height: 20, ), const Padding( padding: EdgeInsets.symmetric(horizontal: 20), child: Text( "*PLEASE ENTER GAME ID SAME AS YOUR OWN ACCOUNT OTHERWISE YOU ARE NOT ALLOWED TO PLAY", style: TextStyle(color: Colors.orange, fontSize: 20), ), ), ], )), Obx( () => eventController.is_joining.value ? Container( color: const Color.fromARGB(39, 158, 158, 158), height: Get.height, width: Get.width, child: const Center( child: SizedBox( height: 80, width: 80, child: CircularProgressIndicator(), )), ) : const Text(""), ), ], ), ); } } String? validateID(String? id) { if (id == null || id.isEmpty) { return "please enter the ID"; } return null; }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Join-now/joinNow-squad.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Event-controller/eventController.dart'; import 'package:gamaru_mobile_app/game_screen.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; bool isChecked = false; class JoinNowSquad extends StatefulWidget { final String eventName; final int entryFee; final int index; final DateTime dt; const JoinNowSquad( {super.key, required this.entryFee, required this.index, required this.dt, required this.eventName}); @override State<JoinNowSquad> createState() => _JoinNowSquadState(); } class _JoinNowSquadState extends State<JoinNowSquad> { final eventController = Get.put(EventController()); final fromKey = GlobalKey<FormState>(); @override void initState() { super.initState(); eventController.getBgmiId(); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, iconTheme: const IconThemeData(color: Colors.white), title: const Text( "JOIN NOW", style: TextStyle(color: Colors.white), ), ), body: SingleChildScrollView( child: Stack( children: [ Container( height: Get.height, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 200, child: Center( child: LottieBuilder.asset( "Assets/squad.json", frameRate: FrameRate.max, ), ), ), GlossyCard( height: Get.height * .53, width: Get.width - 30.0, borderRadius: 10.0, borderWith: 2.0, child: Form( key: fromKey, child: Column( children: [ Padding( padding: const EdgeInsets.only( left: 15, right: 15, top: 20, bottom: 0), child: TextFormField( validator: (value) => validateID(value), controller: eventController.player1, keyboardType: TextInputType.text, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "ENTER PLAYER-1 GAME ID NAME", hintStyle: TextStyle( color: Colors.white60, fontSize: 15), prefixIcon: Icon( Icons.tag_rounded, color: Colors.white60, ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ), Padding( padding: const EdgeInsets.only( left: 15, right: 15, top: 20, bottom: 0), child: TextFormField( validator: (value) => validateID(value), controller: eventController.player2, keyboardType: TextInputType.text, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "ENTER PLAYER-2 GAME ID NAME", hintStyle: TextStyle( color: Colors.white60, fontSize: 15), prefixIcon: Icon( Icons.tag_rounded, color: Colors.white60, ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ), Padding( padding: const EdgeInsets.only( left: 15, right: 15, top: 20, bottom: 0), child: TextFormField( validator: (value) => validateID(value), controller: eventController.player3, keyboardType: TextInputType.text, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "ENTER PLAYER-3 GAME ID NAME", hintStyle: TextStyle( color: Colors.white60, fontSize: 15), prefixIcon: Icon( Icons.tag_rounded, color: Colors.white60, ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ), Padding( padding: const EdgeInsets.only( left: 15, right: 15, top: 20, bottom: 0), child: TextFormField( validator: (value) => validateID(value), controller: eventController.player4, keyboardType: TextInputType.text, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "ENTER PLAYER-4 GAME ID NAME", hintStyle: TextStyle( color: Colors.white60, fontSize: 15), prefixIcon: Icon( Icons.tag_rounded, color: Colors.white60, ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ), Padding( padding: const EdgeInsets.symmetric( horizontal: 12, vertical: 0), child: Row( children: [ Checkbox( checkColor: Colors.white, value: isChecked, onChanged: (bool? value) { setState(() { isChecked = value!; }); }, ), const Text( "SAVE FOR FURTHER USE", style: TextStyle(color: Colors.white), ) ], ), ), const SizedBox( height: 5, ), ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: BorderSide(color: Colors.green))), backgroundColor: MaterialStatePropertyAll(Colors.green), foregroundColor: MaterialStatePropertyAll(Colors.white), ), onPressed: () { final from = fromKey.currentState!; if (from.validate()) { if (isChecked) { eventController.updateBgmiId( eventController.player1.text, eventController.player2.text, eventController.player3.text, eventController.player4.text); } if (widget.eventName.contains("BGMI")) { eventController.joinBgmi( widget.index, widget.dt, widget.entryFee, "squad", eventController.player1.text, eventController.player2.text, eventController.player3.text, eventController.player4.text); } else if (widget.eventName .contains("FREE FIRE")) { eventController.joinFreeFire( widget.index, widget.dt, widget.entryFee, "squad", eventController.player1.text, eventController.player2.text, eventController.player3.text, eventController.player4.text); } } }, child: SizedBox( width: 130, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text("JOIN NOW ("), LottieBuilder.asset( "Assets/coin.json", animate: false, ), Text( widget.entryFee.toString(), style: TextStyle( color: Color.fromARGB( 255, 255, 234, 45)), ), Text(")") ], ), )) ], ), ), ), SizedBox( height: 20, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Text( "*PLEASE ENTER GAME ID SAME AS YOUR GAME ACCOUNT OTHERWISE YOU ARE NOT ALLOWED TO PLAY", style: TextStyle(color: Colors.orange, fontSize: 20), ), ), ], )), Obx( () => eventController.is_joining.value ? Container( color: const Color.fromARGB(39, 158, 158, 158), height: Get.height, width: Get.width, child: const Center( child: SizedBox( height: 80, width: 80, child: CircularProgressIndicator(), )), ) : const Text(""), ), ], ), ), ); } } String? validateID(String? id) { if (id == null || id.isEmpty) { return "please enter the ID"; } return null; }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Join-now/joinNow-bgmi.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Event-controller/eventController.dart'; import 'package:gamaru_mobile_app/game_screen.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; bool isChecked = false; class BgmiJoinNow extends StatefulWidget { final String eventName; final int entryFee; final int index; final DateTime dt; const BgmiJoinNow( {super.key, required this.entryFee, required this.index, required this.dt, required this.eventName}); @override State<BgmiJoinNow> createState() => _BgmiJoinNowState(); } class _BgmiJoinNowState extends State<BgmiJoinNow> { final eventController = Get.put(EventController()); final fromKey = GlobalKey<FormState>(); @override void initState() { super.initState(); eventController.getBgmiId(); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, iconTheme: const IconThemeData(color: Colors.white), title: const Text( "JOIN NOW", style: TextStyle(color: Colors.white), ), ), body: Stack( children: [ Container( height: Get.height, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 250, child: Center( child: LottieBuilder.asset( "Assets/JoinNow.json", frameRate: FrameRate.max, ), ), ), GlossyCard( height: Get.height * .28, width: Get.width - 30.0, borderRadius: 10.0, borderWith: 2.0, child: Form( key: fromKey, child: Column( children: [ Padding( padding: const EdgeInsets.only( left: 15, right: 15, top: 20, bottom: 0), child: TextFormField( validator: (value) => validateID(value), controller: eventController.player1, keyboardType: TextInputType.text, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "ENTER YOUR GAME ID NAME", hintStyle: TextStyle( color: Colors.white60, fontSize: 15), prefixIcon: Icon( Icons.tag_rounded, color: Colors.white60, ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ), Padding( padding: const EdgeInsets.symmetric( horizontal: 12, vertical: 0), child: Row( children: [ Checkbox( checkColor: Colors.white, value: isChecked, onChanged: (bool? value) { setState(() { isChecked = value!; }); }, ), Text( "SAVE FOR FURTHER USE", style: TextStyle(color: Colors.white), ) ], ), ), SizedBox( height: 5, ), ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: BorderSide(color: Colors.green))), backgroundColor: MaterialStatePropertyAll(Colors.green), foregroundColor: MaterialStatePropertyAll(Colors.white), ), onPressed: () { final from = fromKey.currentState!; if (from.validate()) { if (isChecked) { eventController.updateBgmiId( eventController.player1.text, eventController.player2.text, eventController.player3.text, eventController.player4.text); } if (widget.eventName.contains("BGMI")) { eventController.joinBgmi( widget.index, widget.dt, widget.entryFee, "solo", eventController.player1.text, eventController.player2.text, eventController.player3.text, eventController.player4.text); } else if (widget.eventName .contains("FREE FIRE")) { eventController.joinFreeFire( widget.index, widget.dt, widget.entryFee, "solo", eventController.player1.text, eventController.player2.text, eventController.player3.text, eventController.player4.text); } } }, child: SizedBox( width: 130, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text("JOIN NOW ("), LottieBuilder.asset( "Assets/coin.json", animate: false, ), Text( widget.entryFee.toString(), style: TextStyle( color: Color.fromARGB( 255, 255, 234, 45)), ), Text(")") ], ), )) ], ), ), ), SizedBox( height: 20, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Text( "*PLEASE ENTER GAME ID SAME AS YOUR OWN ACCOUNT OTHERWISE YOU ARE NOT ALLOWED TO PLAY", style: TextStyle(color: Colors.orange, fontSize: 20), ), ), ], )), Obx( () => eventController.is_joining.value ? Container( color: const Color.fromARGB(39, 158, 158, 158), height: Get.height, width: Get.width, child: const Center( child: SizedBox( height: 80, width: 80, child: CircularProgressIndicator(), )), ) : const Text(""), ), ], ), ); } } String? validateID(String? id) { if (id == null || id.isEmpty) { return "please enter the ID"; } return null; }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/refer_screen/refer_earn_screen.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/ReferalController/referalController.dart'; import 'package:gamaru_mobile_app/Screens/refer_screen/referrals_list.dart'; import 'package:get/get.dart'; import 'package:icons_plus/icons_plus.dart'; import 'package:lottie/lottie.dart'; import 'package:share_plus/share_plus.dart'; import 'package:url_launcher/url_launcher.dart'; class ReferAndEarn extends StatefulWidget { const ReferAndEarn({super.key}); @override State<ReferAndEarn> createState() => _ReferAndEarnState(); } class _ReferAndEarnState extends State<ReferAndEarn> { final referalController = Get.put(ReferalController()); @override void initState() { super.initState(); referalController.getIdAmount(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, leading: BackButton( color: Colors.white, ), title: Text( "Refer and Earn", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), ), body: Obx( () => Container( color: Colors.black, width: Get.width, child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.all(8.0), child: GlossyCard( height: Get.height * .82, width: Get.width * 0.95, borderRadius: 10.0, borderWith: 1.0, child: Container( alignment: Alignment.topCenter, width: Get.width * .79, height: Get.height, color: Colors.transparent, child: Column( children: [ LottieBuilder.asset( "Assets/refer.json", height: 180, width: 180, repeat: false, ), Text( "Refer friends and earn!", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 18), ), Text( "For every referral you and your ", style: TextStyle( color: Color.fromARGB(188, 255, 255, 255), ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "friend get", style: TextStyle( color: Color.fromARGB(188, 255, 255, 255), ), ), Padding( padding: const EdgeInsets.only(left: 8.0), child: StreamBuilder( stream: FirebaseFirestore.instance .collection("ReferalAmount") .doc("refAmount") .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { return Text( snapshot.data! .data()!["amount"] .toString() + " Play Coins", style: TextStyle( color: Colors.white, fontSize: 19, fontWeight: FontWeight.w700), ); } else { return Text(""); } }, )), ], ), const SizedBox( height: 10, ), GlossyCard( borderRadius: 5.0, borderWith: 2.0, height: 50.0, width: 250.0, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: 5, ), Text( "Your Code : ${referalController.refId.value}", style: TextStyle( color: Colors.white, fontSize: 20), ), SizedBox( width: 3, ), IconButton( onPressed: () async { await Clipboard.setData(ClipboardData( text: referalController .refId.value)) .then((value) { Get.snackbar( "Copied to Clipboard", "", snackPosition: SnackPosition.BOTTOM, colorText: Colors.green, ); }); }, icon: Icon(Icons.copy)) ], ), ), Stack( children: [ Padding( padding: const EdgeInsets.only(top: 22.0), child: GlossyCard( height: Get.height * .36, width: Get.width, borderRadius: 10.0, borderWith: 1.0, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(5), color: Color.fromARGB(180, 21, 20, 20)), height: Get.height * .36, width: Get.width, child: Column( children: [ Padding( padding: const EdgeInsets.all(15.0), child: Text( "Share the referral link via", style: TextStyle( color: Color.fromARGB( 188, 255, 255, 255)), ), ), Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ InkWell( onTap: () async { String refMessage = ''''Hey, I'm loving "Gamaru" – it's a blast! 🎮 play BGMI, Free Fire and many more and win real cash!💸🔥 Join Gamaru and let's both get ${referalController.refAmount.value.toString()} play coins. Just download Gamaru apk : www.gamaru.online and use my code: ${referalController.refId.value} . Game on!'''; FocusManager .instance.primaryFocus ?.unfocus(); final message = Uri.encodeFull( refMessage); final url = "https://wa.me/?text=$message"; try { launch(url); } catch (e) { //To handle error and display error message print("error"); } }, child: Logo( Logos.whatsapp, size: 40, ), ), InkWell( onTap: () async { String refMessage = ''''Hey, I'm loving "Gamaru" – it's a blast! 🎮 play BGMI, Free Fire and many more and win real cash!💸🔥 Join Gamaru and let's both get ${referalController.refAmount.value.toString()} play coins. Just download Gamaru apk : www.gamaru.online and use my code: ${referalController.refId.value} . Game on!'''; Share.share(refMessage, subject: 'Gamaru Referal'); }, child: Logo( Logos.facebook_messenger, size: 40, ), ), InkWell( onTap: () async { String refMessage = ''''Hey, I'm loving "Gamaru" – it's a blast! 🎮 play BGMI, Free Fire and many more and win real cash!💸🔥 Join Gamaru and let's both get ${referalController.refAmount.value.toString()} play coins. Just download Gamaru apk : www.gamaru.online and use my code: ${referalController.refId.value} . Game on!'''; Share.share(refMessage, subject: 'Gamaru Referal'); }, child: Logo( Logos.telegram, size: 40, ), ), Container( decoration: BoxDecoration( color: Color.fromARGB( 108, 87, 89, 2), shape: BoxShape.circle), child: Column( children: [ IconButton( onPressed: () { String refMessage = ''''Hey, I'm loving "Gamaru" – it's a blast! 🎮 play BGMI, Free Fire and many more and win real cash!💸🔥 Join Gamaru and let's both get ${referalController.refAmount.value.toString()} play coins. Just download Gamaru apk : www.gamaru.online and use my code: ${referalController.refId.value} . Game on!'''; Share.share(refMessage, subject: 'Gamaru Referal'); }, icon: Icon( Icons.more_horiz, color: Colors.white, size: 40, ), ), ], ), ), ], ), ), Row(children: <Widget>[ Expanded( child: Container( margin: const EdgeInsets.only( left: 10.0, right: 20.0), child: const Divider( color: Colors.white30, height: 36, )), ), const Text( "or", style: TextStyle( color: Colors.white30), ), Expanded( child: Container( margin: const EdgeInsets.only( left: 20.0, right: 10.0), child: const Divider( color: Colors.white30, height: 36, )), ), ]), InkWell( onTap: () async { String refMessage = ''''Hey, I'm loving "Gamaru" – it's a blast! 🎮 play BGMI, Free Fire and many more and win real cash!💸🔥 Join Gamaru and let's both get ${referalController.refAmount.value.toString()} play coins. Just use my referral link: www.gamaru.online and code: ${referalController.refId.value} . Game on!'''; await Clipboard.setData( ClipboardData( text: refMessage)) .then((value) { Get.snackbar( "Copied to Clipboard", "", snackPosition: SnackPosition.BOTTOM, colorText: Colors.green, ); }); }, child: Container( width: Get.width * 0.59, height: 50, decoration: const BoxDecoration( color: Colors.blue, borderRadius: BorderRadius.all( Radius.circular(10))), child: const Center( child: Text( "COPY REFERRAL LINK", style: TextStyle( color: Colors.white, fontWeight: FontWeight.w700, fontSize: 18), )), ), ), Spacer(), InkWell(onTap: () { Get.to(ReferralsList()); }, child: Container( width: Get.width * 0.59, height: 50, decoration: const BoxDecoration( color: Colors.blue, borderRadius: BorderRadius.all( Radius.circular(10))), child: const Center( child: Text( "YOUR REFERRALS", style: TextStyle( letterSpacing: 0, color: Colors.white, fontWeight: FontWeight.w700, fontSize: 18), )), ), ),Spacer(), ], ), ), ), ) ], ) ], ), ), ), ), ], ), ), )); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/refer_screen/referrals_list.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Componants/glossyExtra.dart'; import 'package:get/get.dart'; class ReferralsList extends StatelessWidget { const ReferralsList({super.key}); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: SafeArea( child: ListView.builder( itemCount: 10, itemBuilder: (context, index) { //-----------------------PENDING---------------------------- return Padding( padding: const EdgeInsets.all(6.0), child: GlossyCard( borderRadius: 10.0, borderWith: 1.0, height: 80.0, width: Get.width, child: ListTile( leading: Icon( Icons.email, color: Colors.white38, ), title: Text( 'example@email.com', style: TextStyle( fontWeight: FontWeight.w500, fontSize: 16, color: Colors.white60), ), trailing: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Pending', style: TextStyle( fontWeight: FontWeight.w400, fontStyle: FontStyle.italic, fontSize: 14, color: Colors.orange), ), ], ), subtitle: Text( 'Ask your friend to make his/her first recharge', style: TextStyle( fontWeight: FontWeight.w400, fontSize: 10, color: Colors.orange), ), ), ), ); //-----------------------successful---------------------------- // return Padding( // padding: const EdgeInsets.all(6.0), // child: GlossyCard( // borderRadius: 10.0, // borderWith: 1.0, // height: 80.0, // width: Get.width, // child: ListTile( // leading: Icon( // Icons.email, // color: Colors.white38, // ), // title: Text( // 'example@email.com', // style: TextStyle( // fontWeight: FontWeight.w500, // fontSize: 16, // color: Colors.white60), // ), // trailing: Column( // mainAxisAlignment: MainAxisAlignment.center, // children: [ // Text( // 'Successful', // style: TextStyle( // fontWeight: FontWeight.w400, // fontStyle: FontStyle.italic, // fontSize: 14, // color: Colors.green), // ), // ], // ), // ), // ), // ); }, ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/notifications-screen/notification.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; class Notifications extends StatelessWidget { const Notifications({super.key}); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, title: Text( "NOTIFICATIONS", style: TextStyle( color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold), ), iconTheme: IconThemeData(color: Colors.white), ), body: SizedBox( height: Get.height, width: Get.width, child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ LottieBuilder.asset( "Assets/NoData.json", width: 300, ), Text( "No Notifications", style: TextStyle( color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold), ) ], ), ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Customer Support/SupportScreen.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Main-Controller/mainController.dart'; import 'package:get/get.dart'; import 'package:icons_plus/icons_plus.dart'; import 'package:lottie/lottie.dart'; import 'package:url_launcher/url_launcher.dart'; class SupportScreen extends StatefulWidget { const SupportScreen({super.key}); @override State<SupportScreen> createState() => _SupportScreenState(); } class _SupportScreenState extends State<SupportScreen> { MainController mainController = Get.put(MainController()); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Colors.black, iconTheme: const IconThemeData(color: Colors.white)), backgroundColor: Colors.black, body: SafeArea( child: SingleChildScrollView( child: SizedBox( height: Get.height, width: Get.width, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ const Text( "Request Help", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 25), ), Container( height: 300, width: 300, decoration: BoxDecoration( borderRadius: BorderRadius.circular(125), ), child: Center( child: LottieBuilder.asset( "Assets/support_lot.json", frameRate: FrameRate.max, )), ), const Text( "How Can We Help You", style: TextStyle(color: Colors.white70, fontSize: 24), ), const SizedBox( height: 30, ), const Text( "It looks like you are expriencing problem", style: TextStyle(color: Colors.white70, fontSize: 16), ), const Text( "using our system. We are here to help", style: TextStyle(color: Colors.white70, fontSize: 16), ), const Text( "you. Please get in touch with us and give", style: TextStyle(color: Colors.white70, fontSize: 16), ), const Text( "us a chance to improve.", style: TextStyle(color: Colors.white70, fontSize: 16), ), const SizedBox( height: 30, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ InkWell( onTap: () async { //To remove the keyboard when button is pressed FocusManager.instance.primaryFocus?.unfocus(); var whatsappUrl = "whatsapp://send?phone=+91${mainController.urls["wpNo"]}"; try { launch(whatsappUrl); } catch (e) { //To handle error and display error message print("error"); } }, child: GlossyCard( height: 55.0, width: 150.0, borderRadius: 10.0, borderWith: 1.0, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Logo( Logos.whatsapp, size: 30, ), const SizedBox( width: 5, ), const Text( "Chat with us", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), ), ], )), ), InkWell( onTap: () async { String email = Uri.encodeComponent( "${mainController.urls["email"]}"); String subject = Uri.encodeComponent("Gamaru Support"); String body = Uri.encodeComponent(""); print(subject); //output: Hello%20Flutter Uri mail = Uri.parse( "mailto:$email?subject=$subject&body=$body"); if (await launchUrl(mail)) { //email app opened } else { //email app is not opened } }, child: GlossyCard( height: 55.0, width: 150.0, borderRadius: 10.0, borderWith: 1.0, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Logo( Logos.gmail, size: 30, ), const SizedBox( width: 5, ), const Text( "Mail us", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), ), ], )), ), ], ), const SizedBox( height: 10, ), Column(children: <Widget>[ Row(children: <Widget>[ Expanded( child: Container( margin: const EdgeInsets.only(left: 80.0, right: 20.0), child: const Divider( color: Colors.white30, height: 36, )), ), const Text( "or", style: TextStyle(color: Colors.white30), ), Expanded( child: Container( margin: const EdgeInsets.only(left: 20.0, right: 80.0), child: const Divider( color: Colors.white30, height: 36, )), ), ]), ]), const Text( "Follow us on", style: TextStyle(color: Colors.white60), ), const SizedBox( height: 20, ), Container( padding: const EdgeInsets.symmetric(horizontal: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ InkWell( onTap: () async { var url = Uri.parse( "${mainController.urls["facebookUrl"]}"); await launchUrl(url); }, child: Logo(Logos.facebook_logo)), InkWell( onTap: () async { var url = Uri.parse("${mainController.urls["instaUrl"]}"); await launchUrl(url); }, child: Logo(Logos.instagram)), InkWell( onTap: () async { var url = Uri.parse( "${mainController.urls["linkedinUrl"]}"); await launchUrl(url); }, child: Logo(Logos.linkedin)), InkWell( onTap: () async { var url = Uri.parse("${mainController.urls["twitterUrl"]}"); await launchUrl(url); }, child: Logo(Logos.twitter)), InkWell( onTap: () async { var url = Uri.parse("${mainController.urls["youtubeUrl"]}"); await launchUrl(url); }, child: Logo(Logos.youtube)), ], ), ) ], ), ), )), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Game-Screen/event.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyExtra.dart'; import 'package:gamaru_mobile_app/Screens/Game-Screen/IdPassScreen.dart'; import 'package:gamaru_mobile_app/Screens/Game-Screen/details_screen.dart'; import 'package:gamaru_mobile_app/Screens/Join-now/joinNow-bgmi.dart'; import 'package:gamaru_mobile_app/Screens/Join-now/joinNow-duo.dart'; import 'package:gamaru_mobile_app/Screens/Join-now/joinNow-squad.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; import 'package:lottie/lottie.dart'; import '../../Componants/glossyEffect.dart'; class EventCard extends StatelessWidget { final eventName; final int index; final DateTime eventTime; final List registerList; final eventMap; final eventWinner; final eventPerKill; final eventEntryFee; final eventTotalPlayers; final eventRegisteredPlayers; final id; final pass; const EventCard( {super.key, required this.index, required this.eventEntryFee, required this.eventMap, required this.eventName, required this.eventPerKill, required this.eventRegisteredPlayers, required this.eventTime, required this.eventTotalPlayers, required this.registerList, required this.eventWinner, required this.id, required this.pass}); @override Widget build(BuildContext context) { return Column( children: [ SizedBox( height: 20, ), GlossyCard( height: 510.0, width: Get.width * 0.95, borderRadius: 10.0, borderWith: 2.0, child: Column( children: [ Container( margin: EdgeInsets.symmetric(horizontal: 2.1, vertical: 2), width: Get.width * 0.95, height: 220, decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(8), topRight: Radius.circular(8)), image: DecorationImage( image: AssetImage("Assets/${this.eventName}.png"), fit: BoxFit.cover)), ), SizedBox( height: 10, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( height: 40, width: 40, decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("Assets/g_Logo.png"))), ), const SizedBox( width: 10, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( this.eventName.toString(), style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), ), Text( DateFormat.yMMMEd().add_jm().format(this.eventTime), style: TextStyle(color: Colors.white60), ) ], ), SizedBox( width: 30, ), ], ), SizedBox( height: 10, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 25), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: [ GlossyCard( borderRadius: 5.0, borderWith: 1.0, height: 40.0, width: 150.0, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.map_rounded, color: Colors.white, ), SizedBox( width: 3, ), Text( "MAP - ", style: TextStyle(color: Colors.white), ), Text( this.eventMap.toString(), style: TextStyle(color: Colors.blue), ) ], ), ) ], ), GlossyCard( borderRadius: 5.0, borderWith: 1.0, height: 40.0, width: 150.0, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Image( height: 22, width: 22, image: AssetImage("Assets/trophy-128.png")), SizedBox( width: 3, ), Text( "WINNER - ", style: TextStyle(color: Colors.white), ), LottieBuilder.asset( "Assets/coin.json", frameRate: FrameRate.max, ), Text( this.eventWinner.toString(), style: TextStyle( color: Color.fromARGB(255, 255, 234, 45)), ) ], ), ) ], ), ), SizedBox( height: 10, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 25), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: [ GlossyCard( borderRadius: 5.0, borderWith: 1.0, height: 40.0, width: 150.0, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.tag_rounded, color: Colors.white, ), SizedBox( width: 3, ), Text( "PER KILL - ", style: TextStyle(color: Colors.white), ), LottieBuilder.asset( "Assets/coin.json", animate: false, ), Text( this.eventPerKill.toString(), style: TextStyle(color: Colors.yellow), ) ], ), ) ], ), GlossyCard( borderRadius: 5.0, borderWith: 1.0, height: 40.0, width: 150.0, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: 3, ), Text( "ENTRY FEE - ", style: TextStyle(color: Colors.white), ), LottieBuilder.asset( "Assets/coin.json", animate: false, ), Text( this.eventEntryFee.toString() == "0" ? "FREE" : this.eventEntryFee.toString(), style: TextStyle( color: Color.fromARGB(255, 255, 234, 45)), ) ], ), ) ], ), ), SizedBox( height: 15, ), Padding( padding: EdgeInsets.symmetric(horizontal: 25), child: Column( children: [ LinearProgressIndicator( minHeight: 8, value: this.eventRegisteredPlayers / this.eventTotalPlayers, ), SizedBox( height: 4, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "${this.eventRegisteredPlayers.toString()}/${this.eventTotalPlayers.toString()}", style: TextStyle(color: Colors.white60), ), Text( "Only ${this.eventTotalPlayers - this.eventRegisteredPlayers} spots left", style: TextStyle(color: Colors.white60), ) ], ), SizedBox( height: 6, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: BorderSide(color: Colors.blue))), backgroundColor: MaterialStatePropertyAll(Colors.blue), foregroundColor: MaterialStatePropertyAll(Colors.white)), onPressed: () { Get.to(DetailsScreen()); }, child: Text("DETAILS")), ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: BorderSide( color: registerList.contains( FirebaseAuth.instance .currentUser!.email .toString()) ? id != "" ? Color.fromARGB( 255, 178, 9, 205) : Colors.grey : Colors.green))), backgroundColor: registerList.contains( FirebaseAuth.instance.currentUser!.email .toString()) ? id != "" ? const MaterialStatePropertyAll( Color.fromARGB(255, 178, 9, 205)) : MaterialStatePropertyAll(Colors.grey) : MaterialStatePropertyAll(Colors.green), foregroundColor: MaterialStatePropertyAll(Colors.white), ), onPressed: () { if (registerList.length >= eventTotalPlayers) { Get.snackbar("EVENT IS FULL", "Maximum number of players has been joined", colorText: Colors.red); } else { if (!registerList.contains(FirebaseAuth .instance.currentUser!.email) && (registerList.length < eventTotalPlayers)) { if (eventName == "FREE FIRE SOLO MATCH") { Get.to(() => BgmiJoinNow( index: index, entryFee: eventEntryFee, dt: eventTime, eventName: eventName, )); } else if (eventName == "BGMI SOLO MATCH") { Get.to(() => BgmiJoinNow( index: index, entryFee: eventEntryFee, dt: eventTime, eventName: eventName, )); } else if (eventName == "BGMI DUO MATCH") { Get.to(() => JoinNowDuo( index: index, entryFee: eventEntryFee, dt: eventTime, eventName: eventName, )); } else if (eventName == "BGMI SQUAD MATCH") { Get.to(() => JoinNowSquad( index: index, entryFee: eventEntryFee, dt: eventTime, eventName: eventName, )); } else if (eventName == "FREE FIRE DUO MATCH") { Get.to(() => JoinNowDuo( index: index, entryFee: eventEntryFee, dt: eventTime, eventName: eventName, )); } else if (eventName == "FREE FIRE SQUAD MATCH") { Get.to(() => JoinNowSquad( index: index, entryFee: eventEntryFee, dt: eventTime, eventName: eventName, )); } else {} } else { if (id != "") { Get.to(() => IdPass( registeredPlayers: registerList, id: id, pass: pass, eventName: eventName, email: FirebaseAuth .instance.currentUser!.email .toString(), )); } } } }, child: Text(registerList.contains(FirebaseAuth .instance.currentUser!.email .toString()) ? id != "" && registerList.contains(FirebaseAuth .instance.currentUser!.email .toString()) ? "GET ID PASS" : "JOINED" : "JOIN NOW")), ], ), registerList.contains(FirebaseAuth .instance.currentUser!.email .toString()) ? Text( "* Get Room ID & PASS 10 mins before the match", style: TextStyle(color: Colors.red), ) : Text( "", ) ], ), ) ], )), ], ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Game-Screen/details_screen.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:get/get.dart'; class DetailsScreen extends StatelessWidget { const DetailsScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( extendBodyBehindAppBar: false, resizeToAvoidBottomInset: true, backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.transparent, leading: BackButton( color: Colors.white, ), title: Text( "BGMI SQUAD MATCH", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), ), body: Center( child: SingleChildScrollView( child: Container( decoration: const BoxDecoration(color: Colors.transparent), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ // SizedBox( // height: 35, // ), Container( height: Get.height * .25, width: Get.width, child: Image( fit: BoxFit.cover, image: AssetImage("Assets/BGMI_details_page.png"), ), ), Container( height: Get.height * .06, width: Get.width, decoration: BoxDecoration( color: Colors.white24, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(15), bottomRight: Radius.circular(15))), child: Center( child: Text( "About this match", style: TextStyle(color: Colors.white, fontSize: 25), ), ), ), const Padding( padding: EdgeInsets.only(right: 190, bottom: 5, top: 15), child: Card( color: Colors.white, child: Center( child: Text( "IMPORTANT RULES", style: TextStyle(color: Colors.black, fontSize: 20), ), ), ), ), Padding( padding: const EdgeInsets.only(left: 5), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ // Padding( // padding: EdgeInsets.only(top: 8.0, left: 8.0), // child: Text( // "1. Cheating and Hacking:", // style: TextStyle( // color: Colors.red, // fontSize: 16, // fontWeight: FontWeight.bold), // ), // ), Padding( padding: EdgeInsets.all(8.0), child: Text( "1. Strictly forbidden any form of cheating, hacking, or using unauthorized software to gain an unfair advantage. This includes wall hacks, aimbots, and any other hacks that compromise the integrity of the game", style: TextStyle(color: Colors.white, fontSize: 15), ), ), // ---------------------------------------------------------------- // Padding( // padding: EdgeInsets.only(top: 8.0, left: 8.0), // child: Text( // "2. Inflammatory or Offensive Content: ", // style: TextStyle( // color: Colors.red, // fontSize: 16, // fontWeight: FontWeight.bold), // ), // ), Padding( padding: EdgeInsets.all(8.0), child: Text( "2. Prohibit the use of offensive, racist, sexist, or any other inappropriate language, behavior, or content during the event. Maintain a respectful & inclusive environment for all participants.", style: TextStyle(color: Colors.white, fontSize: 15), ), ), //-------------------------------------------------------------------- // Padding( // padding: EdgeInsets.only(top: 8.0, left: 8.0), // child: Text( // "3. Unsportsmanlike Behavior:", // style: TextStyle( // color: Colors.red, // fontSize: 16, // fontWeight: FontWeight.bold), // ), // ), Padding( padding: EdgeInsets.all(8.0), child: Text( "3. Discourage unsportsmanlike behavior such as taunting opponents, insulting or harassing fellow players, or engaging in any disruptive actions that negatively impact the gaming experience.", style: TextStyle(color: Colors.white, fontSize: 15), ), ), //------------------------------------------------------------------ // Padding( // padding: EdgeInsets.only(top: 8.0, left: 8.0), // child: Text( // "4. Collusion or Match-Fixing:", // style: TextStyle( // color: Colors.red, // fontSize: 16, // fontWeight: FontWeight.bold), // ), // ), Padding( padding: EdgeInsets.all(8.0), child: Text( "4. Strictly disallow any form of collusion or match-fixing among participants. Every game should be played with genuine effort and intent to win.", style: TextStyle(color: Colors.white, fontSize: 15), ), ), //----------------------------------------------------------------------- // Padding( // padding: EdgeInsets.only(top: 8.0, left: 8.0), // child: Text( // "5. Unauthorized Prizes or Rewards:", // style: TextStyle( // color: Colors.red, // fontSize: 16, // fontWeight: FontWeight.bold), // ), // ), Padding( padding: EdgeInsets.all(8.0), child: Text( "5. Ensure that all prizes, rewards, or giveaways provided during the event are legitimate, and that there is no false advertisement or misrepresentation of the rewards.", style: TextStyle(color: Colors.white, fontSize: 15), ), ), //-------------------------------------------------------------------- // Padding( // padding: EdgeInsets.only(top: 8.0, left: 8.0), // child: Text( // "6. Underage Gambling and Restrictions:", // style: TextStyle( // color: Colors.red, // fontSize: 16, // fontWeight: FontWeight.bold), // ), // ), Padding( padding: EdgeInsets.all(8.0), child: Text( "6. If the event involves gambling mechanics, ensure that it is compliant with legal regulations and age restrictions. Do not encourage underage participants to engage in any form of gambling.", style: TextStyle(color: Colors.white, fontSize: 15), ), ), //--------------------------------------------------------------- // Padding( // padding: EdgeInsets.only(top: 8.0, left: 8.0), // child: Text( // "7. Exploiting Vulnerabilities:", // style: TextStyle( // color: Colors.red, // fontSize: 16, // fontWeight: FontWeight.bold), // ), // ), Padding( padding: EdgeInsets.all(8.0), child: Text( "7. Prohibit participants from exploiting glitches, bugs, or vulnerabilities within the game to gain an unfair advantage. Report such issues to the game developers for resolution.", style: TextStyle(color: Colors.white, fontSize: 15), ), ), //--------------------------------------------------------------- // Padding( // padding: EdgeInsets.only(top: 8.0, left: 8.0), // child: Text( // "8. Privacy Violations:", // style: TextStyle( // color: Colors.red, // fontSize: 16, // fontWeight: FontWeight.bold), // ), // ), Padding( padding: EdgeInsets.all(8.0), child: Text( "8. Respect the privacy of participants by not sharing personal information without explicit consent. Avoid any form of doxxing or harassment.", style: TextStyle(color: Colors.white, fontSize: 15), ), ), //--------------------------------------------------------------- // Padding( // padding: EdgeInsets.only(top: 8.0, left: 8.0), // child: Text( // "9. Unverified Source Code or Modifications:", // style: TextStyle( // color: Colors.red, // fontSize: 16, // fontWeight: FontWeight.bold), // ), // ), Padding( padding: EdgeInsets.all(8.0), child: Text( "9. Do not allow participants to use modified game code or unauthorized mods that could compromise the security of the game or provide an unfair advantage.", style: TextStyle(color: Colors.white, fontSize: 15), ), ), //--------------------------------------------------------------- ], ), ) ], ), ), ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Game-Screen/IdPassScreen.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; class IdPass extends StatelessWidget { final String eventName; final String id; final String pass; final String email; final List registeredPlayers; const IdPass({ super.key, required this.email, required this.id, required this.pass, required this.eventName, required this.registeredPlayers, }); @override Widget build(BuildContext context) { int slotNo = registeredPlayers.indexOf(email) + 1; return Scaffold( backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, iconTheme: const IconThemeData(color: Colors.white70), title: Text( eventName, style: const TextStyle( color: Colors.white70, fontWeight: FontWeight.w600), )), body: SizedBox( width: Get.width, child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [ LottieBuilder.asset( "Assets/howToJoinLogo.json", height: 250, frameRate: FrameRate.max, ), GlossyCard( height: 70.0, width: 200.0, borderRadius: 20.0, borderWith: 2.0, child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Text( "Slot No : $slotNo ", style: TextStyle(color: Colors.white, fontSize: 28), ), ], ), ), ), const SizedBox( height: 20, ), GlossyCard( height: 70.0, width: Get.width * 0.9, borderRadius: 20.0, borderWith: 2.0, child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ const SizedBox( width: 1, ), Text( "Id : $id", style: const TextStyle(color: Colors.white, fontSize: 28), ), const SizedBox( width: 1, ), IconButton( onPressed: () async { await Clipboard.setData(ClipboardData(text: id)) .then((_) { Get.snackbar( "Id Copied", "", snackPosition: SnackPosition.BOTTOM, colorText: Colors.green, ); }); }, icon: const Icon(Icons.copy)) ], ))), const SizedBox( height: 20, ), GlossyCard( height: 70.0, width: Get.width * 0.9, borderRadius: 20.0, borderWith: 2.0, child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ const SizedBox( width: 1, ), Text( "Password : $pass", style: const TextStyle(color: Colors.white, fontSize: 24), ), const SizedBox( width: 1, ), IconButton( onPressed: () async { await Clipboard.setData(ClipboardData(text: pass)) .then((value) { Get.snackbar( "Password Copied", "", snackPosition: SnackPosition.BOTTOM, colorText: Colors.green, ); }); }, icon: const Icon(Icons.copy)) ], ))), const SizedBox( height: 30, ), const Padding( padding: EdgeInsets.symmetric(horizontal: 20), child: Text( "*JOIN AS SOON AS POSSIABLE", style: TextStyle(color: Colors.orange, fontSize: 20), ), ), ]), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/result-screen/result_screen.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Controllers/Main-Controller/mainController.dart'; import 'package:gamaru_mobile_app/Screens/result-screen/result_card.dart'; import 'package:get/get.dart'; class ResultScreen extends StatefulWidget { const ResultScreen({super.key}); @override State<ResultScreen> createState() => _ResultScreenState(); } class _ResultScreenState extends State<ResultScreen> { MainController mainController = Get.put(MainController()); @override void initState() { // TODO: implement initState super.initState(); mainController.loadAllResult(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: Container( color: Colors.black, width: Get.width, padding: EdgeInsets.only(top: 20, left: 10, right: 10), child: Obx( () => SizedBox( height: Get.height, child: ListView( children: mainController.allResults.value.map((e) { Timestamp t = e["time"]; DateTime dt = t.toDate(); List names = e["names"]; List prize = e["prize"]; String eventName = e["eventName"]; return Padding( padding: const EdgeInsets.only(bottom: 16), child: ResultCard( date: dt, eventName: eventName, name1: names[0], name2: names[1], name3: names[2], prize1: prize[0].toString(), prize2: prize[1].toString(), prize3: prize[2].toString()), ); }).toList(), ), ), )), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/result-screen/result_card.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; import 'package:lottie/lottie.dart'; class ResultCard extends StatelessWidget { final String eventName; final String name1; final String name2; final String name3; final String prize1; final String prize2; final String prize3; final DateTime date; const ResultCard( {super.key, required this.date, required this.eventName, required this.name1, required this.name2, required this.name3, required this.prize1, required this.prize2, required this.prize3}); @override Widget build(BuildContext context) { return GlossyCard( height: 260.0, width: Get.width * 0.95, borderRadius: 10.0, borderWith: 2.0, child: SizedBox( height: 300, child: Column(children: [ const SizedBox( height: 20, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( height: 40, width: 40, decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("Assets/g_Logo.png"))), ), const SizedBox( width: 10, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( eventName, style: const TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), ), Text( DateFormat.yMMMEd().add_jm().format(date), style: const TextStyle(color: Colors.white60), ) ], ), const SizedBox( width: 30, ), ], ), Padding( padding: const EdgeInsets.only(left: 40, right: 40, top: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SizedBox( height: 140, child: Column( children: [ const Text( "Name", style: TextStyle( color: Colors.cyan, fontWeight: FontWeight.w700, fontSize: 18), ), Container( margin: const EdgeInsets.only(bottom: 12), height: 2, width: 90, color: Colors.cyan, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(bottom: 16), child: Row( children: [ Image.asset( "Assets/golden_trophy.png", height: 18, color: Colors.amber, ), Padding( padding: const EdgeInsets.only(left: 4), child: Text( name1, style: const TextStyle( color: Colors.white70), ), ) ], ), ), Padding( padding: const EdgeInsets.only(bottom: 16), child: Row( children: [ Image.asset( "Assets/golden_trophy.png", height: 18, color: const Color.fromARGB( 255, 170, 166, 166), ), Padding( padding: const EdgeInsets.only(left: 4), child: Text( name2, style: const TextStyle( color: Colors.white70), ), ) ], ), ), Row( children: [ Image.asset( "Assets/golden_trophy.png", height: 18, color: const Color.fromARGB(255, 103, 58, 11), ), Padding( padding: const EdgeInsets.only(left: 4), child: Text( name3, style: const TextStyle(color: Colors.white70), ), ) ], ) ], ) ], ), ), SizedBox( height: 140, child: Column( children: [ const Text( "Prize", style: TextStyle( color: Colors.cyan, fontWeight: FontWeight.w700, fontSize: 18), ), Container( height: 2, width: 90, margin: const EdgeInsets.only(bottom: 12), color: Colors.cyan, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(bottom: 16), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ LottieBuilder.asset( "Assets/coin.json", animate: false, ), Padding( padding: const EdgeInsets.only(left: 2), child: Text( prize1, style: const TextStyle( color: Colors.yellow), ), ) ], )), Padding( padding: const EdgeInsets.only(bottom: 16), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ LottieBuilder.asset( "Assets/coin.json", animate: false, ), Padding( padding: const EdgeInsets.only(left: 2), child: Text( prize2, style: const TextStyle( color: Colors.yellow), ), ) ], )), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ LottieBuilder.asset( "Assets/coin.json", animate: false, ), Padding( padding: const EdgeInsets.only(left: 2), child: Text( prize3, style: const TextStyle(color: Colors.yellow), ), ) ], ) ], ) ], ), ), ], ), ), InkWell( onTap: () { Get.snackbar( "No Data Available", "Please ry again later", colorText: Colors.white, ); }, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "View all", style: TextStyle(color: Colors.blue), ), Icon( Icons.arrow_forward_ios_rounded, color: Colors.blue, size: 18, ) ], ), ) ]), )); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Home-Screen/homeScreen.dart
import 'package:flutter/material.dart'; import 'package:flutter_custom_carousel_slider/flutter_custom_carousel_slider.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Main-Controller/mainController.dart'; import 'package:gamaru_mobile_app/Screens/Home-Screen/home_shimmer.dart'; import 'package:gamaru_mobile_app/Screens/refer_screen/refer_earn_screen.dart'; import 'package:gamaru_mobile_app/game_screen.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import 'package:url_launcher/url_launcher.dart'; import '../Customer Support/SupportScreen.dart'; import '../Top-section-every/top-part.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({super.key}); @override State<HomeScreen> createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { MainController mainController = Get.put(MainController()); List<CarouselItem> itemList = [ CarouselItem( image: const AssetImage("Assets/ref_banner.jpg"), boxDecoration: BoxDecoration( gradient: LinearGradient( begin: FractionalOffset.bottomCenter, end: FractionalOffset.topCenter, colors: [ Colors.blueAccent.withOpacity(1), Colors.black.withOpacity(.3), ], stops: const [0.0, 1.0], ), ), title: 'Push your creativity to its limits by reimagining this classic puzzle!', titleTextStyle: const TextStyle( fontSize: 12, color: Colors.white, ), leftSubtitle: '\$51,046 in prizes', rightSubtitle: '4882 participants', rightSubtitleTextStyle: const TextStyle( fontSize: 12, color: Colors.black, ), onImageTap: (i) { Get.to(ReferAndEarn()); }, ), CarouselItem( image: const AssetImage("Assets/coustomer_service.png"), title: '@coskuncay published flutter_custom_carousel_slider!', titleTextStyle: const TextStyle( fontSize: 12, color: Colors.white, ), leftSubtitle: '11 Feb 2022', rightSubtitle: 'v1.0.0', onImageTap: (i) { Get.to(SupportScreen()); }, ), ]; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: SafeArea( child: Column( children: [ TopDetails(), Container( height: Get.height - 146, padding: EdgeInsets.only(top: 20), child: ListView( children: [ Container( padding: EdgeInsets.symmetric( horizontal: 5, ), height: 85, width: Get.width, child: CustomCarouselSlider( items: itemList, subHeight: 50, width: MediaQuery.of(context).size.width * .9, autoplay: true, showText: false, showSubBackground: false, indicatorShape: BoxShape.rectangle, selectedDotColor: Colors.white, unselectedDotColor: Colors.white60, ), ), SizedBox( height: 30, ), Row( children: [ Container( padding: EdgeInsets.only(top: 10), child: const Text( " GAMES FOR YOU", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), ), ), LottieBuilder.asset( "Assets/fire.json", height: 30, frameRate: FrameRate.max, ) ], ), InkWell( splashFactory: NoSplash.splashFactory, onTap: () { Get.to(GameScreen( gameName: "BATTLE GROUNDS MOBILE INDIA", )); }, child: Container( height: 220, decoration: const BoxDecoration( image: DecorationImage( image: AssetImage( "Assets/bgmi_home.png", ), fit: BoxFit.cover)), ), ), InkWell( splashFactory: NoSplash.splashFactory, onTap: () { Get.to(GameScreen( gameName: "FREE FIRE", )); }, child: Container( height: 200, decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("Assets/FreeFire_home.png"), ), ), ), ), SizedBox( height: 8.0, ), InkWell( splashFactory: NoSplash.splashFactory, onTap: () { Get.to(GameScreen( gameName: "LUDO", )); }, child: Padding( padding: const EdgeInsets.only( right: 18, ), child: Container( height: 220, decoration: BoxDecoration( image: DecorationImage( image: AssetImage("Assets/ludo_home_screen.png"), fit: BoxFit.cover, ), ), ), ), ), SizedBox( height: 27, ), InkWell( splashFactory: NoSplash.splashFactory, onTap: () { Get.to(GameScreen( gameName: "CARROM", )); }, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Container( height: 175, width: Get.width - 45, decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(10)), image: DecorationImage( image: AssetImage( "Assets/carrom_home_screen.jpg"), fit: BoxFit.fitWidth), ), ), ], ), ), ), SizedBox( height: 30, ), Padding( padding: const EdgeInsets.all(15.0), child: Row( children: [ Container( decoration: BoxDecoration( color: Colors.white24, borderRadius: BorderRadius.circular(5)), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8), child: Text( "How to ?", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 17, color: Colors.white), ), ), ), SizedBox( width: 0, ), Expanded( child: Padding( padding: const EdgeInsets.only(right: 8), child: Divider( height: 20, thickness: 0.3, indent: 15, endIndent: 0, color: Colors.white, ), ), ), ], ), ), Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: GlossyCard( borderWith: 0.4, height: Get.height * 0.15, width: Get.width * 0.89, borderRadius: 15.0, child: Container( child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ InkWell( onTap: () async { var url = Uri.parse( "${mainController.urls["howToJoin"]}"); await launchUrl(url); }, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ LottieBuilder.asset( "Assets/howToJoinLogo.json", height: 70, width: 70, repeat: true, ), Text( "Join", style: TextStyle( color: Colors.white, fontSize: 18), ) ], ), ), InkWell( onTap: () async { var url = Uri.parse( "${mainController.urls["howToPlay"]}"); await launchUrl(url); }, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ LottieBuilder.asset( "Assets/play_home_screen.json", height: 70, width: 70, repeat: true, ), Text( "Play", style: TextStyle( color: Colors.white, fontSize: 18), ) ], ), ), InkWell( onTap: () async { var url = Uri.parse( "${mainController.urls["howToEarn"]}"); await launchUrl(url); }, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ LottieBuilder.asset( "Assets/earn_home_screen.json", height: 70, width: 70, repeat: true, ), const Text( "Earn", style: TextStyle( color: Colors.white, fontSize: 18), ) ], ), ), ], ), ), ), ), SizedBox( height: 20, ) ], ), ) ], ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/Home-Screen/home_shimmer.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/login-singup-screen/login_page.dart'; import 'package:gamaru_mobile_app/Screens/navigation_bar.dart'; import 'package:get/get.dart'; import 'package:shimmer/shimmer.dart'; class HomeShimmer extends StatefulWidget { const HomeShimmer({super.key}); @override State<HomeShimmer> createState() => _HomeShimmerState(); } class _HomeShimmerState extends State<HomeShimmer> { @override void initState() { // TODO: implement initState super.initState(); Future.delayed(const Duration(milliseconds: 500), () { // Here you can write your code if (FirebaseAuth.instance.currentUser == null) { Get.offAll(const Login()); } else { Get.offAll(MainScreen()); } }); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: Shimmer.fromColors( baseColor: const Color.fromARGB(255, 50, 49, 49), highlightColor: const Color.fromARGB(255, 99, 98, 98), child: SingleChildScrollView( child: SafeArea( child: SizedBox( height: Get.height, width: Get.width, child: Column(children: [ const SizedBox( height: 20, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( height: 30, width: 100, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(6)), ), const SizedBox( width: 40, ), Container( height: 30, width: 60, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(16)), ), Container( height: 30, width: 60, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(16)), ), Container( height: 30, width: 30, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(10)), ) ], ), ), Container( margin: const EdgeInsets.only(top: 20, left: 5, right: 5), height: 90, width: Get.width, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(16)), ), Row( children: [ Container( margin: const EdgeInsets.only(top: 30, left: 5, right: 5), height: 30, width: 210, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(6)), ), ], ), Container( margin: const EdgeInsets.only(top: 40, left: 25, right: 25), height: 170, width: Get.width, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(16)), ), Container( margin: const EdgeInsets.only(top: 30, left: 25, right: 25), height: 170, width: Get.width, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(16)), ), Container( margin: const EdgeInsets.only(top: 30, left: 25, right: 25), height: 170, width: Get.width, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(16)), ), ]), ), ), ), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/coins-exchange-screen/exchange_screen.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Controllers/Main-Controller/mainController.dart'; import 'package:gamaru_mobile_app/Controllers/Wallet-Controller/walletController.dart'; import 'package:gamaru_mobile_app/Screens/Customer%20Support/SupportScreen.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; // import 'package:razorpay_flutter/razorpay_flutter.dart'; class ExchangeScreen extends StatefulWidget { const ExchangeScreen({super.key}); @override State<ExchangeScreen> createState() => _ExchangeScreenState(); } class _ExchangeScreenState extends State<ExchangeScreen> { int balance = 0; // final _razorpay = Razorpay(); final fromKey = GlobalKey<FormState>(); MainController mainController = Get.put(MainController()); int winCoins = 0; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, iconTheme: const IconThemeData(color: Colors.white), title: const Text( "EXCHANGE", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), )), body: SizedBox( width: Get.width, child: Column(children: [ const SizedBox( height: 20, ), Container( height: 48, width: 270, padding: const EdgeInsets.symmetric( horizontal: 10, ), decoration: BoxDecoration( color: const Color.fromARGB(255, 78, 78, 78).withOpacity(0.9), borderRadius: BorderRadius.circular(15)), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Play Coins - ", style: TextStyle(color: Colors.white, fontSize: 24), ), LottieBuilder.asset( "Assets/coin.json", height: 30, width: 20, frameRate: FrameRate.max, ), const SizedBox( width: 2, ), StreamBuilder( stream: FirebaseFirestore.instance .collection("user") .doc(FirebaseAuth.instance.currentUser!.email .toString()) .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { int coins = snapshot!.data!.data()!["coins"]; return Text( coins.toString(), style: const TextStyle( color: Colors.yellow, fontSize: 20), ); } else { return const Text("0"); } }, ) ], ), ), ), const SizedBox( height: 40, ), Container( height: 48, width: 270, padding: const EdgeInsets.symmetric( horizontal: 10, ), decoration: BoxDecoration( color: const Color.fromARGB(255, 78, 78, 78).withOpacity(0.9), borderRadius: BorderRadius.circular(15)), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Win Coins - ", style: TextStyle(color: Colors.white, fontSize: 24), ), LottieBuilder.asset( "Assets/winning_coin.json", height: 30, width: 20, frameRate: FrameRate.max, ), const SizedBox( width: 2, ), StreamBuilder( stream: FirebaseFirestore.instance .collection("user") .doc(FirebaseAuth.instance.currentUser!.email .toString()) .snapshots(), builder: (context, snapshot) { if (snapshot.hasData) { int coins = snapshot!.data!.data()!["winCoins"]; balance = coins; winCoins = coins; return Text( coins.toString(), style: TextStyle(color: Colors.yellow, fontSize: 20), ); } else { balance = 0; return Text("0"); } }, ) ], ), ), ), const SizedBox( height: 40, ), Form( key: fromKey, child: Padding( padding: const EdgeInsets.only(left: 40, right: 40), child: TextFormField( controller: mainController.winCoins, validator: (value) { if (value!.isEmpty) { return "Please Enter some Amount"; } else if (int.parse(mainController.winCoins.text) > winCoins) { return "Don't have this much win coins"; } else if (int.parse(mainController.winCoins.text) < 10) { return "Can't be less than ten"; } else { return null; } }, onChanged: (value) { mainController.palyCoins.value = value; }, keyboardType: TextInputType.number, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none, fontSize: 24, fontWeight: FontWeight.bold), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Win Coins Amount", hintStyle: TextStyle(color: Colors.white60, fontSize: 24), prefixIcon: Icon( Icons.pending, color: Colors.white60, size: 28, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), ), ), const Padding( padding: EdgeInsets.symmetric(vertical: 10), child: Icon( Icons.arrow_downward_rounded, color: Colors.white60, size: 50, ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "You will get ", style: TextStyle(color: Colors.white70, fontSize: 18), ), LottieBuilder.asset("Assets/coin.json"), const SizedBox( width: 2, ), Obx( () => Text( mainController.palyCoins.value == "" ? "0" : mainController.palyCoins.value, style: TextStyle(color: Colors.white70, fontSize: 18), ), ), const Text( " in you account", style: TextStyle(color: Colors.white70, fontSize: 18), ), ], ), const SizedBox( height: 30, ), mainController.exchangeLoading.value ? ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all<RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: const BorderSide(color: Colors.green))), backgroundColor: const MaterialStatePropertyAll(Colors.green)), onPressed: () {}, child: CircularProgressIndicator()) : ElevatedButton( style: ButtonStyle( shape: MaterialStateProperty.all<RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5), side: const BorderSide(color: Colors.green))), backgroundColor: const MaterialStatePropertyAll(Colors.green)), onPressed: () async { final from = fromKey.currentState!; if (from.validate()) { int a = int.parse(mainController.winCoins.text); mainController.exchangeCoins(a); } }, child: const Text( "Exchange Now", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), ), ), const SizedBox( height: 20, ), const SizedBox( height: 10, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Facing issue?", style: TextStyle(color: Colors.white, fontSize: 18), ), const SizedBox( width: 15, ), InkWell( onTap: () { Get.to(() => const SupportScreen()); }, child: const Text( "Contact Us", style: TextStyle( color: Colors.blue, fontSize: 18, fontWeight: FontWeight.bold, decoration: TextDecoration.underline, decorationColor: Colors.blue, ), ), ) ], ), const SizedBox( height: 30, ), const Padding( padding: EdgeInsets.symmetric(horizontal: 20), child: Text( 'Note that : You can only exchange win coins to play coins', style: TextStyle( fontSize: 17, color: Colors.orange, fontWeight: FontWeight.w700), ), ), ]), )); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/login-singup-screen/signup_page.dart
import 'package:email_validator/email_validator.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/background_style.dart'; import 'package:gamaru_mobile_app/Controllers/ReferalController/referalController.dart'; import 'package:gamaru_mobile_app/Screens/login-singup-screen/referScreen.dart'; import 'package:get/get.dart'; import '../../Componants/glossyEffect.dart'; import '../../Controllers/Login-Contollers/autehntication.dart'; import '../../Controllers/Login-Contollers/signinSignupController.dart'; import 'login_page.dart'; class SignUp extends StatefulWidget { const SignUp({super.key}); @override State<SignUp> createState() => _SignUpState(); } class _SignUpState extends State<SignUp> { bool equalOrnot = true; final referalController = Get.put(ReferalController()); final Authentication authentication = Get.put(Authentication()); final signupController = Get.put(SignupController()); bool _isVisible1 = false; bool _isVisible2 = false; final fromKey = GlobalKey<FormState>(); void updateStatus1() { setState(() { _isVisible1 = !_isVisible1; }); } void updateStatus2() { setState(() { _isVisible2 = !_isVisible2; }); } @override void dispose() { authentication.errorMsgup!.value = ""; super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Stack( children: [ const BackgroundStyle( UpperCircleColor1: Color.fromARGB(255, 228, 26, 247), UpperCircleColor2: Color.fromARGB(255, 23, 7, 245), LowerCircleColor1: Color.fromARGB(255, 248, 9, 61), LowerCircleColor2: Color.fromARGB(255, 235, 20, 217)), Container( padding: const EdgeInsets.only(top: 30), child: Center( child: GlossyCard( borderWith: 0.4, height: Get.height * 0.75, width: Get.width * 0.89, borderRadius: 15.0, child: SingleChildScrollView( child: Container( padding: const EdgeInsets.only(top: 15, bottom: 10), width: Get.width * 0.79, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Signup", style: TextStyle( color: Colors.white70, fontSize: 30, fontWeight: FontWeight.bold), ), const Text( "Just some details to get you in!", style: TextStyle( color: Colors.white70, fontSize: 16), ), const SizedBox( height: 15, ), Form( key: fromKey, child: Column( children: [ // TextFormField( // controller: // signupController.phoneNumberController, // keyboardType: TextInputType.phone, // validator: (value) => validatePhone(value), // style: TextStyle( // color: Colors.white60, // decoration: TextDecoration.none), // decoration: const InputDecoration( // fillColor: Colors.transparent, // hintText: "Phone no", // hintStyle: // TextStyle(color: Colors.white60), // prefixIcon: Icon( // Icons.phone_android, // color: Colors.white60, // ), // enabledBorder: OutlineInputBorder( // borderRadius: BorderRadius.all( // Radius.circular(10)), // borderSide: BorderSide( // color: Colors.white60)), // errorBorder: OutlineInputBorder( // borderRadius: BorderRadius.all( // Radius.circular(10)), // borderSide: // BorderSide(color: Colors.red)), // focusedBorder: OutlineInputBorder( // borderRadius: BorderRadius.all( // Radius.circular(10)), // borderSide: // BorderSide(color: Colors.purple)), // ), // ), // SizedBox( // height: 15, // ), TextFormField( controller: signupController.emailController, keyboardType: TextInputType.emailAddress, autofillHints: const [ AutofillHints.email ], validator: (email) => email != null && !EmailValidator.validate(email) ? "Enter a valid email" : null, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Email", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.email_rounded, color: Colors.white60, ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide( color: Colors.white60)), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide( color: Colors.purple)), ), ), const SizedBox( height: 15, ), TextFormField( controller: signupController.passwordController1, keyboardType: TextInputType.visiblePassword, obscureText: !_isVisible1, validator: (value) => validatePassword(value), style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: InputDecoration( fillColor: Colors.transparent, hintText: "password", hintStyle: const TextStyle( color: Colors.white60), prefixIcon: const Icon( Icons.lock, color: Colors.white60, ), suffixIcon: IconButton( color: Colors.white60, onPressed: () => updateStatus1(), icon: Icon(_isVisible1 ? Icons.visibility : Icons.visibility_off)), errorBorder: const OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: const OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide( color: Colors.white60)), focusedBorder: const OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide( color: Colors.purple)), ), ), const SizedBox( height: 15, ), TextFormField( controller: signupController.passwordController2, keyboardType: TextInputType.visiblePassword, obscureText: !_isVisible2, validator: (value) => validatePassword(value), style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: InputDecoration( fillColor: Colors.transparent, hintText: "Confirm password", hintStyle: const TextStyle( color: Colors.white60), prefixIcon: const Icon( Icons.lock, color: Colors.white60, ), suffixIcon: IconButton( color: Colors.white60, onPressed: () => updateStatus2(), icon: Icon(_isVisible2 ? Icons.visibility : Icons.visibility_off)), errorBorder: const OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: const BorderRadius.all( Radius.circular(10)), borderSide: BorderSide( color: equalOrnot ? Colors.white60 : Colors.red)), focusedBorder: OutlineInputBorder( borderRadius: const BorderRadius.all( Radius.circular(10)), borderSide: BorderSide( color: equalOrnot ? Colors.purple : Colors.red)), ), ), const SizedBox( height: 5, ), Obx(() => Text( authentication.errorMsgup!.value, style: const TextStyle( color: Colors.red), )), const SizedBox( height: 5, ), InkWell( onTap: () async { final from = fromKey.currentState!; if (from.validate()) { if (signupController .passwordController1.text == signupController .passwordController2.text) { // authentication.is_loading.value = // true; Get.to(() => const Refer( isGoogel: false, )); } else { setState(() { equalOrnot = false; }); } } }, child: Container( width: Get.width * 0.79, height: 50, decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ Colors.purple, Colors.blue, ]), borderRadius: BorderRadius.all( Radius.circular(10))), child: const Center( child: Text( "Signup", style: TextStyle( color: Colors.white60, fontWeight: FontWeight.w700, fontSize: 18), )), ), ) ], )), const SizedBox( height: 20, ), Column(children: <Widget>[ Row(children: <Widget>[ Expanded( child: Container( margin: const EdgeInsets.only( left: 10.0, right: 20.0), child: const Divider( color: Colors.white30, height: 36, )), ), const Text( "or", style: TextStyle(color: Colors.white30), ), Expanded( child: Container( margin: const EdgeInsets.only( left: 20.0, right: 10.0), child: const Divider( color: Colors.white30, height: 36, )), ), ]), ]), // Row( // mainAxisAlignment: MainAxisAlignment.center, // children: [ // InkWell( // onTap: () { // // authentication.is_loading.value = true; // // Get.to(() => const Refer(isGoogel: true)); // }, // child: GlossyCard( // height: 50.0, // width: 50.0, // borderRadius: 15.0, // borderWith: 1.1, // child: Container( // height: 30, // width: 30, // decoration: const BoxDecoration( // image: DecorationImage( // image: AssetImage( // "Assets/googleLogo.png"))), // ), // ), // ), // ], // ), const SizedBox( height: 20, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Already have account ?", style: TextStyle(color: Colors.white60), ), InkWell( onTap: () { Get.off(const Login(), transition: Transition.cupertinoDialog); }, child: const Text( " Login", style: TextStyle(color: Colors.blue), ), ) ], ), const SizedBox( height: 25, ), SizedBox( width: Get.width * 0.79, child: const Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "Terms & Conditions", style: TextStyle(color: Colors.white60), ), Text( "Support", style: TextStyle(color: Colors.white60), ), Text( "Customer Care", style: TextStyle(color: Colors.white60), ), ]), ) ], )), )), ), ), Obx( () => authentication.is_loading.value ? Container( color: const Color.fromARGB(39, 158, 158, 158), height: Get.height, width: Get.width, child: const Center( child: CircularProgressIndicator( color: Colors.purple, backgroundColor: Color.fromARGB(255, 9, 113, 198), )), ) : const Text(""), ), ], ), ); } } String? validatePassword(String? pass) { if (pass == null || pass.isEmpty) { return "please enter the password"; } if (pass.length < 5) { return "password can't be to short"; } return null; } String? validatePhone(String? pass) { if (pass == null || pass.isEmpty) { return "please enter the phone no"; } if (pass.length < 10) { return "wrong number please check!"; } if (pass.length > 10) { return "wrong number please check!"; } return null; }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/login-singup-screen/otp_page.dart
// import 'package:firebase_auth/firebase_auth.dart'; // import 'package:flutter/material.dart'; // import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; // import 'package:get/get.dart'; // import '../../Controllers/Login-Contollers/autehntication.dart'; // import '../../Controllers/Login-Contollers/signinSignupController.dart'; // class OtpPage extends StatefulWidget { // @override // // ignore: library_private_types_in_public_api // _OtpPageState createState() => _OtpPageState(); // } // class _OtpPageState extends State<OtpPage> { // final Authentication authentication = Get.put(Authentication()); // final signupController = Get.put(SignupController()); // final auth = FirebaseAuth.instance; // final List<FocusNode> _focusNodes = List.generate(6, (index) => FocusNode()); // final List<TextEditingController> _controllers = // List.generate(6, (index) => TextEditingController()); // @override // void dispose() { // for (var controller in _controllers) { // controller.dispose(); // } // super.dispose(); // } // void _onOtpInputChange(int index) { // if (_controllers[index].text.isNotEmpty && index < 5) { // _focusNodes[index].unfocus(); // _focusNodes[index + 1].requestFocus(); // } // } // void _verifyOtp() async { // String enteredOtp = ''; // for (var controller in _controllers) { // enteredOtp += controller.text; // } // PhoneAuthCredential credential = PhoneAuthProvider.credential( // verificationId: signupController.verificationId, smsCode: enteredOtp); // try { // await auth.signInWithCredential(credential).then((value) { // signupController.registerUser(signupController.emailController.text, // signupController.passwordController1.text); // }); // } catch (e) { // authentication.errorMsgup!.value = "Wrong otp"; // } // print('Entered OTP: $enteredOtp'); // } // @override // Widget build(BuildContext context) { // return Scaffold( // backgroundColor: Colors.white, // body: Container( // decoration: const BoxDecoration( // image: DecorationImage( // image: AssetImage("Assets/BgLogin1.png"), fit: BoxFit.cover)), // child: Center( // child: Padding( // padding: const EdgeInsets.all(20.0), // child: SingleChildScrollView( // child: GlossyCard( // borderWith: 0.4, // height: Get.height * 0.85, // width: Get.width * 0.89, // borderRadius: 15.0, // child: Column( // mainAxisAlignment: MainAxisAlignment.center, // children: [ // // Image.asset( // // 'Assets/gamaru.png', // Replace this with your logo image // // width: 200, // // height: 200, // // ), // const SizedBox(height: 5), // const Text( // 'Enter OTP', // style: TextStyle( // fontSize: 24, // fontWeight: FontWeight.bold, // color: Colors.white), // ), // const SizedBox(height: 10), // const Text( // 'We have sent you an OTP on your mobile number', // style: TextStyle(color: Colors.grey), // textAlign: TextAlign.center, // ), // const SizedBox(height: 30), // Row( // mainAxisAlignment: MainAxisAlignment.center, // children: List.generate( // 6, // (index) => SizedBox( // width: 50, // height: 60, // child: AnimatedBuilder( // animation: _focusNodes[index], // builder: (context, child) { // return Container( // child: TextFormField( // controller: _controllers[index], // focusNode: _focusNodes[index], // onChanged: (val) => _onOtpInputChange(index), // keyboardType: TextInputType.number, // textAlign: TextAlign.center, // maxLength: 1, // style: const TextStyle( // color: Colors.white, // fontSize: 20, // fontWeight: FontWeight.bold, // ), // decoration: InputDecoration( // contentPadding: EdgeInsets.zero, // enabledBorder: const OutlineInputBorder( // borderSide: // BorderSide(color: Colors.grey), // ), // focusedBorder: const OutlineInputBorder( // borderSide: // BorderSide(color: Colors.blue), // ), // filled: true, // fillColor: _focusNodes[index].hasFocus // ? Colors.blue.withOpacity(0.1) // : Colors.transparent, // ), // ), // ); // }, // ), // ), // ), // ), // const SizedBox(height: 10), // Obx(() => Text( // authentication.errorMsgup!.value, // style: const TextStyle(color: Colors.red), // )), // const SizedBox(height: 10), // InkWell( // onTap: _verifyOtp, // child: Container( // width: Get.width * 0.30, // height: 50, // decoration: const BoxDecoration( // gradient: LinearGradient( // begin: Alignment.centerLeft, // end: Alignment.centerRight, // colors: [Colors.blue, Colors.purple]), // borderRadius: // BorderRadius.all(Radius.circular(25))), // child: const Center( // child: Text( // 'Verify OTP', // style: TextStyle(fontSize: 18, color: Colors.white), // ), // ), // ), // ), // ], // ), // ), // ), // ), // ), // ), // ); // } // }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/login-singup-screen/forget_password_page.dart
import 'package:email_validator/email_validator.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/background_style.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Login-Contollers/autehntication.dart'; import 'package:gamaru_mobile_app/Controllers/Login-Contollers/signinSignupController.dart'; import 'package:gamaru_mobile_app/Screens/login-singup-screen/signup_page.dart'; import 'package:get/get.dart'; class ForgetPass extends StatelessWidget { const ForgetPass({super.key}); @override Widget build(BuildContext context) { final fromKey = GlobalKey<FormState>(); final singupController = Get.put(SignupController()); final authentication = Get.put(Authentication()); return Scaffold( resizeToAvoidBottomInset: false, body: Stack( children: [ const BackgroundStyle( UpperCircleColor1: Colors.red, UpperCircleColor2: Color.fromARGB(255, 235, 211, 3), LowerCircleColor1: Colors.yellow, LowerCircleColor2: Color.fromARGB(255, 248, 99, 0)), SafeArea( child: Center( child: SingleChildScrollView( child: Center( child: GlossyCard( borderWith: 0.4, height: Get.height * 0.75, width: Get.width * 0.89, borderRadius: 15.0, child: SizedBox( width: Get.width * 0.79, child: Form( key: fromKey, child: Padding( padding: const EdgeInsets.only(left: 8.0, top: 45.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ const Text( "Forgot Password ?", style: TextStyle( color: Colors.white70, fontSize: 30, fontWeight: FontWeight.bold), ), const Text( "Please enter your email", style: TextStyle( color: Colors.white70, fontSize: 16), ), const SizedBox( height: 15, ), TextFormField( controller: singupController.forgotPassemailController, validator: (email) => email != null && !EmailValidator.validate(email) ? "Enter a valid email" : null, style: const TextStyle( color: Colors.white, decoration: TextDecoration.none), autofillHints: const [AutofillHints.email], decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "example@gmail.com", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.email_rounded, color: Colors.white60, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), SizedBox( height: 25, ), InkWell( onTap: () { final from = fromKey.currentState!; if (from.validate()) { authentication.resetPassword( singupController .forgotPassemailController.text); } }, child: Container( width: Get.width * 0.79, height: 50, decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ Color.fromARGB(255, 255, 119, 28), Color.fromARGB(255, 185, 142, 26) ]), borderRadius: BorderRadius.all( Radius.circular(10))), child: const Center( child: Text( "Reset Password", style: TextStyle( color: Colors.white70, fontWeight: FontWeight.w700, fontSize: 18), )), ), ), SizedBox( height: Get.height * .27, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text("Don't have an account ?", style: TextStyle(color: Colors.white60)), TextButton( onPressed: () { Get.off(const SignUp(), transition: Transition.cupertinoDialog); ; }, child: Text( "Signup", style: TextStyle(color: Colors.blue), )) ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ InkWell( onTap: () {}, child: Text( "Terms & Conditions", style: TextStyle(color: Colors.white60), ), ), InkWell( onTap: () {}, child: Text( "Support", style: TextStyle(color: Colors.white60), ), ), InkWell( onTap: () {}, child: Text( "Customer Care", style: TextStyle(color: Colors.white60), ), ), ], ), ], ), ), ), ), ), ), ), ), ), ], ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/login-singup-screen/referScreen.dart
import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/background_style.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Login-Contollers/autehntication.dart'; import 'package:gamaru_mobile_app/Controllers/Login-Contollers/signinSignupController.dart'; import 'package:get/get.dart'; class Refer extends StatefulWidget { final bool isGoogel; const Refer({super.key, required this.isGoogel}); @override State<Refer> createState() => _ReferState(); } class _ReferState extends State<Refer> { final fromKey = GlobalKey<FormState>(); final signupController = Get.put(SignupController()); final Authentication authentication = Get.put(Authentication()); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Stack( children: [ const BackgroundStyle( UpperCircleColor1: Colors.red, UpperCircleColor2: Colors.green, LowerCircleColor1: Colors.yellow, LowerCircleColor2: Colors.blue), Container( padding: const EdgeInsets.only(top: 30), child: Center( child: GlossyCard( borderWith: 0.4, height: Get.height * 0.45, width: Get.width * 0.89, borderRadius: 15.0, child: SizedBox( width: Get.width * 0.79, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Referal", style: TextStyle( color: Colors.white70, fontSize: 30, fontWeight: FontWeight.bold), ), const Text( "Do you have Referal Code ?", style: TextStyle(color: Colors.white70, fontSize: 16), ), const SizedBox( height: 15, ), Form( key: fromKey, child: Column( children: [ TextFormField( controller: signupController.referalController, keyboardType: TextInputType.emailAddress, autofillHints: const [AutofillHints.email], validator: (email) => email!.length == 5 ? null : "Enter a valid referal Code", style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter the Referal Code", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.handshake, color: Colors.white60, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide( color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), const SizedBox( height: 4, ), Obx(() => Text( authentication.errorMsg!.value, style: const TextStyle(color: Colors.red), )), const SizedBox( height: 5, ), InkWell( onTap: () { final from = fromKey.currentState!; if (from.validate()) { authentication.is_loading.value = true; signupController.registerUser( signupController .emailController.text, signupController .passwordController1.text, signupController .referalController.text); } }, child: Container( width: Get.width * 0.79, height: 50, decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ Colors.blue, Colors.purple ]), borderRadius: BorderRadius.all( Radius.circular(10))), child: const Center( child: Text( "Submit", style: TextStyle( color: Colors.white60, fontWeight: FontWeight.w700, fontSize: 18), )), ), ), const SizedBox( height: 28, ), InkWell( onTap: () { authentication.is_loading.value = true; if (widget.isGoogel) { authentication.googleSignIn( signupController .referalController.text); } else { signupController.registerUser( signupController .emailController.text, signupController .passwordController1.text, signupController .referalController.text); } }, child: Container( width: Get.width * 0.79, height: 50, decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ Colors.purple, Colors.blue ]), borderRadius: BorderRadius.all( Radius.circular(10))), child: const Center( child: Text( "Don't Have Referal", style: TextStyle( color: Colors.white60, fontWeight: FontWeight.w700, fontSize: 18), )), ), ) ], )), const SizedBox( height: 10, ), ], ))), ), ), Obx( () => authentication.is_loading.value ? Container( color: const Color.fromARGB(39, 158, 158, 158), height: Get.height, width: Get.width, child: const Center( child: CircularProgressIndicator( color: Colors.purple, backgroundColor: Color.fromARGB(255, 9, 113, 198), )), ) : const Text(""), ), ], ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Screens
mirrored_repositories/gamaru-mobile-app/lib/Screens/login-singup-screen/login_page.dart
import 'package:email_validator/email_validator.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Componants/background_style.dart'; import 'package:gamaru_mobile_app/Componants/glossyEffect.dart'; import 'package:gamaru_mobile_app/Controllers/Login-Contollers/autehntication.dart'; import 'package:gamaru_mobile_app/Controllers/Login-Contollers/signinSignupController.dart'; import 'package:gamaru_mobile_app/Controllers/ReferalController/referalController.dart'; import 'package:gamaru_mobile_app/Screens/login-singup-screen/forget_password_page.dart'; import 'package:gamaru_mobile_app/Screens/login-singup-screen/signup_page.dart'; import 'package:gamaru_mobile_app/Screens/refer_screen/refer_earn_screen.dart'; import 'package:get/get.dart'; class Login extends StatefulWidget { const Login({super.key}); @override State<Login> createState() => _LoginState(); } class _LoginState extends State<Login> { final signupController = Get.put(SignupController()); final Authentication authentication = Get.put(Authentication()); bool _isVisible1 = false; final fromKey = GlobalKey<FormState>(); void updateStatus1() { setState(() { _isVisible1 = !_isVisible1; }); } @override void dispose() { authentication.errorMsg!.value = ""; super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Stack( children: [ const BackgroundStyle( UpperCircleColor1: Color.fromARGB(255, 255, 0, 170), UpperCircleColor2: Color.fromARGB(255, 0, 57, 245), LowerCircleColor1: Color.fromARGB(255, 0, 60, 255), LowerCircleColor2: Color.fromARGB(255, 248, 6, 188)), Container( padding: const EdgeInsets.only(top: 30), child: Center( child: GlossyCard( borderWith: 0.4, height: Get.height * 0.75, width: Get.width * 0.89, borderRadius: 15.0, child: SizedBox( width: Get.width * 0.79, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Login", style: TextStyle( color: Colors.white70, fontSize: 30, fontWeight: FontWeight.bold), ), const Text( "Glad you're back!", style: TextStyle(color: Colors.white70, fontSize: 16), ), const SizedBox( height: 15, ), Form( key: fromKey, child: Column( children: [ TextFormField( controller: signupController.emailController, keyboardType: TextInputType.emailAddress, autofillHints: const [AutofillHints.email], validator: (email) => email != null && !EmailValidator.validate(email) ? "Enter a valid email" : null, style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: const InputDecoration( fillColor: Colors.transparent, hintText: "Enter your Email", hintStyle: TextStyle(color: Colors.white60), prefixIcon: Icon( Icons.email_rounded, color: Colors.white60, ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide( color: Colors.white60)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), const SizedBox( height: 15, ), TextFormField( controller: signupController.passwordController1, keyboardType: TextInputType.visiblePassword, obscureText: !_isVisible1, validator: (value) => validatePassword(value), style: const TextStyle( color: Colors.white60, decoration: TextDecoration.none), decoration: InputDecoration( fillColor: Colors.transparent, hintText: "Enter your password", hintStyle: const TextStyle( color: Colors.white60), prefixIcon: const Icon( Icons.lock, color: Colors.white60, ), suffixIcon: IconButton( color: Colors.white60, onPressed: () => updateStatus1(), icon: Icon(_isVisible1 ? Icons.visibility : Icons.visibility_off)), enabledBorder: const OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide( color: Colors.white60)), errorBorder: const OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide(color: Colors.red)), focusedBorder: const OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular(10)), borderSide: BorderSide(color: Colors.purple)), ), ), const SizedBox( height: 10, ), Obx(() => Text( authentication.errorMsg!.value, style: const TextStyle(color: Colors.red), )), const SizedBox( height: 5, ), InkWell( onTap: () { final from = fromKey.currentState!; if (from.validate()) { authentication.is_loading.value = true; signupController.loginUser( signupController .emailController.text, signupController .passwordController1.text); } }, child: Container( width: Get.width * 0.79, height: 50, decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ Colors.blue, Colors.purple ]), borderRadius: BorderRadius.all( Radius.circular(10))), child: const Center( child: Text( "Login", style: TextStyle( color: Colors.white60, fontWeight: FontWeight.w700, fontSize: 18), )), ), ) ], )), const SizedBox( height: 10, ), InkWell( onTap: () { Get.off(const ForgetPass(), transition: Transition.cupertinoDialog); }, child: Center( child: Text( "Forgot password ?", style: TextStyle(color: Colors.blue), )), ), const SizedBox( height: 20, ), Column(children: <Widget>[ Row(children: <Widget>[ Expanded( child: Container( margin: const EdgeInsets.only( left: 10.0, right: 20.0), child: const Divider( color: Colors.white30, height: 36, )), ), const Text( "or", style: TextStyle(color: Colors.white30), ), Expanded( child: Container( margin: const EdgeInsets.only( left: 20.0, right: 10.0), child: const Divider( color: Colors.white30, height: 36, )), ), ]), ]), // Row( // mainAxisAlignment: MainAxisAlignment.center, // children: [ // InkWell( // onTap: () { // // authentication.is_loading.value = true; // // authentication.googleSignIn(signupController // // .referalController.text); // }, // child: GlossyCard( // height: 50.0, // width: 50.0, // borderRadius: 15.0, // borderWith: 1.1, // child: Container( // height: 30, // width: 30, // decoration: const BoxDecoration( // image: DecorationImage( // image: AssetImage( // "Assets/googleLogo.png"))), // ), // ), // ), // ], // ), const SizedBox( height: 40, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( "Don't have account ?", style: TextStyle(color: Colors.white60), ), InkWell( onTap: () { Get.off( const SignUp(), transition: Transition.cupertinoDialog, ); }, child: const Text( " Signup", style: TextStyle(color: Colors.blue), ), ) ], ), const SizedBox( height: 20, ), Container( width: Get.width * 0.79, child: const Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "Terms & Conditions", style: TextStyle(color: Colors.white60), ), Text( "Support", style: TextStyle(color: Colors.white60), ), Text( "Customer Care", style: TextStyle(color: Colors.white60), ), ]), ) ], ))), ), ), Obx( () => authentication.is_loading.value ? Container( color: const Color.fromARGB(39, 158, 158, 158), height: Get.height, width: Get.width, child: const Center( child: CircularProgressIndicator( color: Colors.purple, backgroundColor: Color.fromARGB(255, 9, 113, 198), )), ) : const Text(""), ), ], ), ); } } String? validatePassword(String? pass) { if (pass == null || pass.isEmpty) { return "please enter the password"; } if (pass.length < 5) { return "password can't be to short"; } return null; }
0
mirrored_repositories/gamaru-mobile-app/lib/Controllers
mirrored_repositories/gamaru-mobile-app/lib/Controllers/Main-Controller/mainController.dart
import 'dart:async'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/widgets.dart'; import 'package:gamaru_mobile_app/Screens/navigation_bar.dart'; import 'package:get/get.dart'; class MainController extends GetxController { static MainController get instance => Get.find(); final _db = FirebaseFirestore.instance; final user = FirebaseAuth.instance.currentUser; RxInt navBarIndex = 1.obs; RxBool is_loading = false.obs; RxBool exchangeLoading = false.obs; RxMap urls = {}.obs; TextEditingController winCoins = TextEditingController(); RxString palyCoins = "".obs; RxList allResults = [].obs; loadData() async { await FirebaseFirestore.instance .collection("loading") .doc("gamaru") .get() .then((value) { is_loading.value = value["is_loading"]; }); } void exchangeCoins(int amount) async { exchangeLoading.value = true; await _db .collection("user") .doc(user!.email.toString()) .get() .then((value) async { int playCoins = value["coins"]; int winCoins = value["winCoins"]; if (amount > winCoins) { return; } winCoins = winCoins - amount; playCoins = playCoins + amount; await _db .collection("user") .doc(user!.email.toString()) .update({"coins": playCoins, "winCoins": winCoins}).then((value) { exchangeLoading.value = false; Get.offAll(MainScreen()); }); }); } loadAllResult() async { await FirebaseFirestore.instance .collection("result") .doc("allResult") .get() .then((value) { List temp = value["res"]; List temp2 = []; for (int i = 0; i < temp.length; i++) { List nam = temp[i]["names"]; List p = temp[i]["prize"]; if (nam.length == 3 && p.length == 3) { temp2.add(temp[i]); } } allResults.value = temp2; print(allResults.value); }); } getUrls() async { await _db.collection("urls").doc("url").get().then((value) { urls.value = value["allUrls"]; }); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Controllers
mirrored_repositories/gamaru-mobile-app/lib/Controllers/User-Controller/userController.dart
// ignore: file_names import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:gamaru_mobile_app/Controllers/ReferalController/referalController.dart'; import 'package:get/get.dart'; class UserController extends GetxController { static UserController get instance => Get.find(); final referalController = Get.put(ReferalController()); final _db = FirebaseFirestore.instance; var firebaseUser = FirebaseAuth.instance.currentUser; RxInt totalCoins = 0.obs; @override void onReady() { _db.collection("user").doc(firebaseUser!.email).get().then((value) { totalCoins.value = value["coins"]; }); } createUserDataUsingSignin(String id, String email, String referal) async { String refId = referalController.generateUniqueString(email); await _db .collection("user transactions") .doc(email) .set({"transactions": []}); await _db.collection("user").doc(email).set({ "id": id, "email": email, "coins": 0, "bgmiId": "", "player2": "", "player3": "", "player4": "", "winCoins": 0, "bankCards": [], "withdrawNo": "", "refId": refId, "rechargeFirst": true, "referal": referal, "allRef": [], }).then((_) { _db .collection("user") .doc(email) .collection("watchCoinsWin") .doc("watchCoins") .set({"coinsAd": 0}); _db.collection("refId").doc(refId).set({"email": email}).then((_) { _db.collection("refId").doc(referal).get().then((value) { List allRefral = value["allRef"]; allRefral.add(email); _db.collection("refId").doc(referal).update({"allRef": allRefral}); }); }); }); } createUserDataUsingGoogleSignin( String id, String email, String referal) async { print("jsdkjbbajkdfasjksdaskjdaskjd runninhg ndklahdsklakdhaskldsakld"); var a = await _db.collection('user').doc(email).get(); if (a.exists) { print("data already exists"); } else { String refId = referalController.generateUniqueString(email); await _db .collection("user transactions") .doc(email) .set({"transactions": []}); await _db.collection("user").doc(email).set({ "id": id, "email": email, "coins": 0, "bgmiId": "", "player2": "", "player3": "", "player4": "", "winCoins": 0, "bankCards": [], "rechargeNo": "", "refId": refId, "rechargeFirst": true, "refefral": referal, "allRef": [] }).then((_) { _db .collection("user") .doc(email) .collection("watchCoinsWin") .doc("watchCoins") .set({"coinsAd": 0}); _db .collection("refId") .doc(refId) .set({"email": email, "allRef": []}).then((_) { _db.collection("refId").doc(referal).get().then((value) { List allRefral = value["allRef"]; allRefral.add(email); _db.collection("refId").doc(referal).update({"allRef": allRefral}); }); }); }); } } }
0
mirrored_repositories/gamaru-mobile-app/lib/Controllers
mirrored_repositories/gamaru-mobile-app/lib/Controllers/Login-Contollers/autehntication.dart
import 'dart:async'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Controllers/Main-Controller/mainController.dart'; import 'package:gamaru_mobile_app/Controllers/User-Controller/userController.dart'; import 'package:gamaru_mobile_app/Screens/login-singup-screen/login_page.dart'; import 'package:gamaru_mobile_app/Screens/navigation_bar.dart'; import 'package:get/get.dart'; import 'package:google_sign_in/google_sign_in.dart'; import 'package:uuid/uuid.dart'; class Authentication extends GetxController { static Authentication get instance => Get.find(); final _auth = FirebaseAuth.instance; late Rx<User?> firebaseUser; RxString? errorMsg = "".obs; RxString? errorMsgup = "".obs; RxString userEmail = "".obs; // ignore: non_constant_identifier_names var is_loading = false.obs; final userController = Get.put(UserController()); final mainController = Get.put(MainController()); @override void onReady() { // Get called after widget is rendered on the screen super.onReady(); firebaseUser = Rx<User?>(_auth.currentUser); firebaseUser.bindStream(_auth.userChanges()); ever(firebaseUser, _setInitScreen); } _setInitScreen(User? user) async { if (user == null) { Get.offAll(() => const Login()); } else { await mainController.loadData(); userEmail.value = _auth.currentUser!.email.toString(); // Get.offAll(() => MainScreen()); } } Future<void> createUserWithEmailPassword( String email, String password, String referal) async { try { await _auth .createUserWithEmailAndPassword(email: email, password: password) .then((value) async { await userController.createUserDataUsingSignin( Uuid().v1(), email, referal); is_loading.value = false; }); } on FirebaseAuthException catch (e) { if (e.code == "email-already-in-use") { errorMsgup!.value = "Already have account! Login"; } else if (e.code == "wrong-password") { errorMsgup!.value = "Wrong password"; } else { errorMsgup!.value = "An error occourd"; } is_loading.value = false; } } Future<void> loginUserWithEmailPassword(String email, String password) async { try { await _auth .signInWithEmailAndPassword(email: email, password: password) .then((value) { is_loading.value = false; }); } on FirebaseAuthException catch (e) { if (e.code == "user-not-found") { errorMsg!.value = "user not exits! Sign Up"; } else if (e.code == "wrong-password") { errorMsg!.value = "Wrong password"; } else { errorMsg!.value = "An error occourd"; } is_loading.value = false; } } googleSignIn(String referal) async { try { GoogleSignInAccount? googleUser = await GoogleSignIn().signIn(); GoogleSignInAuthentication? googleAuth = await googleUser?.authentication; AuthCredential credential = GoogleAuthProvider.credential( accessToken: googleAuth?.accessToken, idToken: googleAuth?.idToken, ); _auth.signInWithCredential(credential).then((value) async { print("hiiiii ${value.user!.email}"); await userController.createUserDataUsingGoogleSignin( Uuid().v1(), value.user!.email.toString().trim(), referal); is_loading.value = false; }); } catch (e) { print(e); print("error"); is_loading.value = false; } } Future<void> resetPassword(String email) async { try { await _auth.sendPasswordResetEmail(email: email).then((value) { print("email sent"); Get.dialog( AlertDialog( backgroundColor: Color.fromARGB(255, 245, 117, 13), // title: const Text(""), content: const Text( 'An email has been sent please reset the password and try again!', style: TextStyle(color: Colors.white70, fontSize: 20), ), actions: [ TextButton( child: const Text( "ok", style: TextStyle( color: Color.fromARGB(255, 160, 2, 239), fontSize: 20), ), onPressed: () => Get.to(Login()), ), ], ), ); // Get.off(Login()); }); } catch (e) { print("error happens"); } } Future<void> logOut() async => await _auth.signOut().then((value) { is_loading.value = false; }); }
0
mirrored_repositories/gamaru-mobile-app/lib/Controllers
mirrored_repositories/gamaru-mobile-app/lib/Controllers/Login-Contollers/signinSignupController.dart
// ignore: file_names import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/Home-Screen/home_shimmer.dart'; import 'package:get/get.dart'; import 'autehntication.dart'; class SignupController extends GetxController { static SignupController get instance => Get.find(); //Testfield controllers to get data from textfield var nameController = TextEditingController(); var phoneNumberController = TextEditingController(); var emailController = TextEditingController(); var passwordController1 = TextEditingController(); var passwordController2 = TextEditingController(); var referalController = TextEditingController(); String verificationId = ""; var forgotPassemailController = TextEditingController(); void registerUser(String email, String password, String referal) { Authentication.instance .createUserWithEmailPassword(email, password, referal) .then((value) { Get.offAll(const HomeShimmer()); }); } void loginUser(String email, String password) async { await Authentication.instance .loginUserWithEmailPassword(email, password) .then((value) { Get.offAll(const HomeShimmer()); }); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Controllers
mirrored_repositories/gamaru-mobile-app/lib/Controllers/ReferalController/referalController.dart
// ignore: file_names import 'dart:convert'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:crypto/crypto.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:get/get.dart'; class ReferalController extends GetxController { static ReferalController get instance => Get.find(); RxString refId = "".obs; RxInt refAmount = 0.obs; String generateUniqueString(String input) { // Calculate a hash of the input string using SHA-256 final bytes = utf8.encode(input); final digest = sha256.convert(bytes); // Take the first 5 characters of the hexadecimal digest final hash = digest.toString().substring(0, 5); return hash; } getIdAmount() async { await FirebaseFirestore.instance .collection("user") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .get() .then((value) async { refId.value = value["refId"]; print("ansssssssssssssssssssssssssssssssssssssssssssssssssssssss" + refId.value); await FirebaseFirestore.instance .collection("ReferalAmount") .doc("refAmount") .get() .then((value) { refAmount.value = value["amount"]; }); }); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Controllers
mirrored_repositories/gamaru-mobile-app/lib/Controllers/AdController/adController.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:get/get.dart'; class AdController extends GetxController { static AdController get instance => Get.find(); RxBool ad_isLoading = false.obs; final _db = FirebaseFirestore.instance; var firebaseUser = FirebaseAuth.instance.currentUser; Future<void> updateWinCoins() async { int b = 0; await _db .collection("user") .doc(firebaseUser!.email.toString()) .collection("watchCoinsWin") .doc("watchCoins") .get() .then((value) { b = value["coinsAd"]; _db .collection("user") .doc(firebaseUser!.email.toString()) .collection("watchCoinsWin") .doc("watchCoins") .update({"coinsAd": b + 1}); }); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Controllers
mirrored_repositories/gamaru-mobile-app/lib/Controllers/Wallet-Controller/walletController.dart
import 'dart:async'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/RechargeDone.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/upi_payment_screen.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/withdrawComplete.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/withdrawFaild.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/withdrawl.dart'; import 'package:get/get.dart'; class WalletController extends GetxController { static WalletController get instance => Get.find(); final _db = FirebaseFirestore.instance; final user = FirebaseAuth.instance.currentUser; RxBool myWalletStatus = false.obs; TextEditingController adMoneyController = TextEditingController(); TextEditingController withdrawMoneyController = TextEditingController(); RxString fee = "0".obs; RxString toAccount = "0".obs; TextEditingController accountNoController = TextEditingController(); TextEditingController bankNameController = TextEditingController(); TextEditingController nameController = TextEditingController(); TextEditingController phoneNoController = TextEditingController(); TextEditingController ifscCodeController = TextEditingController(); TextEditingController addressController = TextEditingController(); TextEditingController rechargeNoController = TextEditingController(); TextEditingController refNoController = TextEditingController(); RxList bankCardList = [].obs; var bankCardDetails = null; RxBool is_withdrawing = false.obs; RxString upiId = "".obs; RxBool qrRecharge = false.obs; getUpiId(String phNo) { _db.collection("upi").doc("upiId").get().then((value) { upiId.value = value["upi"]; Get.to(UpiScreen( phNo: phNo, )); }); } addBankCard( accountNoorUPI, bankName, name, phoneNo, ifscCode, address) async { await _db .collection("user") .doc(user!.email.toString()) .get() .then((value) async { List l = value["bankCards"]; l.add({ "accNoorUpi": accountNoorUPI, "bankName": bankName, "name": name, "phoneNO": phoneNo, "ifscCode": ifscCode, "address": address }); await _db .collection("user") .doc(user!.email.toString()) .update({"bankCards": l}).then((value) { Get.off(WithdrawScreen()); }); }); } getBankCardList() { _db.collection("user").doc(user!.email.toString()).get().then((value) { List l = value["bankCards"]; bankCardList.value = l; }); } withdrawAmount(int amount, var card, int fee) async { is_withdrawing.value = true; try { await _db .collection("user") .doc(user!.email.toString()) .get() .then((value) async { int winCoins = value["winCoins"]; winCoins = winCoins - amount; await _db .collection("user") .doc(user!.email) .update({"winCoins": winCoins}).then((_) async { print("in getting"); await _db .collection("user transactions") .doc(user!.email) .get() .then((v) async { List transactionList = v["transactions"]; transactionList.insert(0, { "amount": (amount - fee), "card": card, "email": user!.email, "reason": "Withdraw", "time": DateTime.now(), "fee": fee, "add": false }); await _db .collection("user transactions") .doc(user!.email.toString()) .update({"transactions": transactionList}).then((value) async { await _db .collection("withdraw") .doc("all transactions") .get() .then((value) async { transactionList = value["transactions"]; transactionList.insert(0, { "amount": (amount - fee), "card": card, "email": user!.email, "reason": "Withdraw", "time": DateTime.now(), "fee": fee, "add": false, "paid": false, }); await _db .collection("withdraw") .doc("all transactions") .update({"transactions": transactionList}).then((_) { Timer(const Duration(milliseconds: 800), () { is_withdrawing.value = false; Get.to(const WithdrawComplete()); }); }); }); }); }); }); }); } catch (e) { Get.to(WithdrawFailed()); } } saveToAllRecharge(String refNo, int amount, String phNO) async { await _db .collection("recharges") .doc("allRecharges") .get() .then((value) async { List l = value["all"]; l.insert(0, { "amount": amount, "email": FirebaseAuth.instance.currentUser!.email, "fee": 0, "reason": "Recharge", "time": DateTime.now(), "add": true, "refNo": refNo, "phNO": phNO, "verified": false }); await _db .collection("recharges") .doc("allRecharges") .update({"all": l}).then((value) { Get.off(const RechargeDone()); }); }); } paymentSuccess(int amount) async { await _db .collection("user") .doc(user!.email.toString()) .get() .then((v) async { bool rechargeFirst = v["rechargeFirst"]; if (rechargeFirst) { await _db .collection("user") .doc(user!.email.toString()) .get() .then((value) async { int coins = value["coins"]; String referal = value["referal"]; await _db .collection("ReferalAmount") .doc("refAmount") .get() .then((value1) async { int refReward = value1["amount"]; await _db .collection("refId") .doc(referal) .get() .then((value2) async { String referalEmail = value2["email"]; if (referalEmail == "") { referalEmail = "joy18"; } coins = coins + amount; await _db .collection("user") .doc(user!.email.toString()) .update({"coins": coins}).then((value) async { await _db .collection("user transactions") .doc(user!.email.toString()) .get() .then((value) async { List tList = value["transactions"]; tList.insert(0, { "amount": amount, "email": FirebaseAuth.instance.currentUser!.email, "fee": 0, "reason": "Recharge", "time": DateTime.now(), "add": true, }); await _db .collection("user transactions") .doc(FirebaseAuth.instance.currentUser!.email) .update({"transactions": tList}).then((value) async { await _db .collection("user") .doc(user!.email.toString()) .get() .then((value) async { coins = value["coins"]; coins = coins + refReward; await _db .collection("user") .doc(user!.email.toString()) .update({"coins": coins}).then((value) async { await _db .collection("user transactions") .doc(user!.email.toString()) .get() .then((value) async { List tList = value["transactions"]; tList.insert(0, { "amount": refReward, "email": FirebaseAuth.instance.currentUser!.email, "fee": 0, "reason": "Referal Reward", "time": DateTime.now(), "add": true, }); await _db .collection("user transactions") .doc(FirebaseAuth.instance.currentUser!.email) .update({"transactions": tList}).then( (value) async { await _db .collection("user") .doc(referalEmail) .get() .then((value) async { int coins = value["coins"]; coins = coins + refReward; await _db .collection("user") .doc(referalEmail) .update({"coins": coins}).then((value) async { await _db .collection("user transactions") .doc(referalEmail) .get() .then((value) async { List tList = value["transactions"]; tList.insert(0, { "amount": refReward, "email": referalEmail, "fee": 0, "reason": "Referal Reward", "time": DateTime.now(), "add": true, }); await _db .collection("user transactions") .doc(referalEmail) .update({"transactions": tList}).then( (value) async { await _db .collection("user") .doc(user!.email.toString()) .update({"rechargeFirst": false}).then( (value) { // Get.to(() => const RechargeDone()); }); }); }); }); }); }); }); }); }); }); }); }); }); }); }); } else { await _db .collection("user") .doc(user!.email.toString()) .get() .then((value) async { int coins = value["coins"]; coins = coins + amount; await _db .collection("user") .doc(user!.email.toString()) .update({"coins": coins}).then((value) async { await _db .collection("user transactions") .doc(user!.email.toString()) .get() .then((value) async { List tList = value["transactions"]; tList.insert(0, { "amount": amount, "email": FirebaseAuth.instance.currentUser!.email, "fee": 0, "reason": "Recharge", "time": DateTime.now(), "add": true, }); await _db .collection("user transactions") .doc(FirebaseAuth.instance.currentUser!.email) .update({"transactions": tList}).then((value) { // Get.to(() => const RechargeDone()); }); }); }); }); } }); } saveNumForRecharge(String nu) async { await _db .collection("user") .doc(user!.email.toString()) .update({"rechargeNo": nu}); } getNumForRecharge() async { await _db .collection("user") .doc(user!.email.toString()) .get() .then((value) { rechargeNoController.text = value["rechargeNo"]; }); } }
0
mirrored_repositories/gamaru-mobile-app/lib/Controllers
mirrored_repositories/gamaru-mobile-app/lib/Controllers/Event-controller/eventController.dart
import 'dart:async'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:gamaru_mobile_app/Screens/Wallet-Screens/addMoney.dart'; import 'package:get/get.dart'; class EventController extends GetxController { static EventController get instance => Get.find(); final _db = FirebaseFirestore.instance; List eventListBgmiUpcoming = []; // ignore: non_constant_identifier_names RxBool upcoming_loading = true.obs; TextEditingController player1 = TextEditingController(); TextEditingController player2 = TextEditingController(); TextEditingController player3 = TextEditingController(); TextEditingController player4 = TextEditingController(); // ignore: non_constant_identifier_names RxBool is_joining = false.obs; upadteTransaction(int fee) async { await _db .collection("user transactions") .doc(FirebaseAuth.instance.currentUser!.email) .get() .then((value) async { List tList = value["transactions"]; tList.insert(0, { "amount": fee, "email": FirebaseAuth.instance.currentUser!.email, "fee": 0, "reason": "Joined Contest", "time": DateTime.now(), "add": false, }); await _db .collection("user transactions") .doc(FirebaseAuth.instance.currentUser!.email) .update({"transactions": tList}).then((value) { is_joining.value = false; Get.back(); }); }); } Future<void> joinBgmi(int index, DateTime dt, int fee, String matchType, String player1, String player2, String player3, String player4) async { is_joining.value = true; if (matchType == "solo") { await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .get() .then((value) async { int bal = value["coins"]; if (bal < fee) { Timer(const Duration(seconds: 0), () { Get.snackbar(onTap: (snack) { Get.off(const AddMoney()); }, "Low Balance", "Doesn't have sufficient balance", colorText: Colors.red); is_joining.value = false; return; }); } else { bal = bal - fee; await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email) .update({"coins": bal}); await _db .collection("BATTLE GROUNDS MOBILE INDIA") .doc("upcoming") .get() .then((value) async { eventListBgmiUpcoming = value["event"]; List temp = eventListBgmiUpcoming[index]["eventRegisteredPlayers"]; temp.add(FirebaseAuth.instance.currentUser!.email.toString()); eventListBgmiUpcoming[index]["eventRegisteredPlayers"] = temp; await _db .collection("BATTLE GROUNDS MOBILE INDIA") .doc("upcoming") .update({"event": eventListBgmiUpcoming}).then((_) async { await _db .collection("BGMI REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .get() .then((value) async { if (value.exists) { List l = value["players"]; l.add({ "player1": player1, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("BGMI REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .update({"players": l}).then((value) async { upadteTransaction(fee); }); } else { List l = []; l.add({ "player1": player1, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("BGMI REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .set({"players": l}).then((value) async { upadteTransaction(fee); }); } }); }); }); } }); } if (matchType == "duo") { await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .get() .then((value) async { int bal = value["coins"]; if (bal < fee) { Timer(const Duration(seconds: 0), () { Get.snackbar(onTap: (snack) { Get.off(AddMoney()); }, "Low Balance", "Doesn't have sufficient balance", colorText: Colors.red); is_joining.value = false; return; }); } else { bal = bal - fee; await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email) .update({"coins": bal}); await _db .collection("BATTLE GROUNDS MOBILE INDIA") .doc("upcoming") .get() .then((value) async { eventListBgmiUpcoming = value["event"]; List temp = eventListBgmiUpcoming[index]["eventRegisteredPlayers"]; temp.add(FirebaseAuth.instance.currentUser!.email.toString()); eventListBgmiUpcoming[index]["eventRegisteredPlayers"] = temp; await _db .collection("BATTLE GROUNDS MOBILE INDIA") .doc("upcoming") .update({"event": eventListBgmiUpcoming}).then((_) async { await _db .collection("BGMI REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .get() .then((value) async { if (value.exists) { List l = value["players"]; l.add({ "player1": player1, "player2": player2, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("BGMI REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .update({"players": l}).then((value) { upadteTransaction(fee); }); } else { List l = []; l.add({ "player1": player1, "player2": player2, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("BGMI REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .set({"players": l}).then((value) async { upadteTransaction(fee); }); } }); }); }); } }); } if (matchType == "squad") { await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .get() .then((value) async { int bal = value["coins"]; if (bal < fee) { Timer(const Duration(seconds: 0), () { Get.snackbar(onTap: (snack) { Get.off(AddMoney()); }, "Low Balance", "Doesn't have sufficient balance", colorText: Colors.red); is_joining.value = false; return; }); } else { bal = bal - fee; await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email) .update({"coins": bal}); await _db .collection("BATTLE GROUNDS MOBILE INDIA") .doc("upcoming") .get() .then((value) async { eventListBgmiUpcoming = value["event"]; List temp = eventListBgmiUpcoming[index]["eventRegisteredPlayers"]; temp.add(FirebaseAuth.instance.currentUser!.email.toString()); eventListBgmiUpcoming[index]["eventRegisteredPlayers"] = temp; await _db .collection("BATTLE GROUNDS MOBILE INDIA") .doc("upcoming") .update({"event": eventListBgmiUpcoming}).then((_) async { await _db .collection("BGMI REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .get() .then((value) async { if (value.exists) { List l = value["players"]; l.add({ "player1": player1, "player2": player2, "player3": player3, "player4": player4, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("BGMI REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .update({"players": l}).then((value) { upadteTransaction(fee); }); } else { List l = []; l.add({ "player1": player1, "player2": player2, "player3": player3, "player4": player4, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("BGMI REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .set({"players": l}).then((value) async { upadteTransaction(fee); }); } }); }); }); } }); } } getBgmiId() async { _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .get() .then((value) { player1.text = value["bgmiId"]; player2.text = value["player2"]; player3.text = value["player3"]; player4.text = value["player4"]; }); } updateBgmiId( String id, String player2, String player3, String player4) async { _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .update({ "bgmiId": id, "player2": player2, "player3": player3, "player4": player4 }); } Future<void> joinFreeFire(int index, DateTime dt, int fee, String matchType, String player1, String player2, String player3, String player4) async { is_joining.value = true; if (matchType == "solo") { await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .get() .then((value) async { int bal = value["coins"]; if (bal < fee) { Timer(const Duration(seconds: 0), () { Get.snackbar(onTap: (snack) { Get.off(AddMoney()); }, "Low Balance", "Doesn't have sufficient balance", colorText: Colors.red); is_joining.value = false; return; }); } else { bal = bal - fee; await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email) .update({"coins": bal}); await _db .collection("FREE FIRE") .doc("upcoming") .get() .then((value) async { eventListBgmiUpcoming = value["event"]; List temp = eventListBgmiUpcoming[index]["eventRegisteredPlayers"]; temp.add(FirebaseAuth.instance.currentUser!.email.toString()); eventListBgmiUpcoming[index]["eventRegisteredPlayers"] = temp; await _db .collection("FREE FIRE") .doc("upcoming") .update({"event": eventListBgmiUpcoming}).then((_) async { await _db .collection("FREE FIRE REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .get() .then((value) async { if (value.exists) { List l = value["players"]; l.add({ "player1": player1, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("FREE FIRE REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .update({"players": l}).then((value) { upadteTransaction(fee); }); } else { List l = []; l.add({ "player1": player1, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("FREE FIRE REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .set({"players": l}).then((value) async { upadteTransaction(fee); }); } }); }); }); } }); } if (matchType == "duo") { await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .get() .then((value) async { int bal = value["coins"]; if (bal < fee) { Timer(const Duration(seconds: 0), () { Get.snackbar(onTap: (snack) { Get.off(AddMoney()); }, "Low Balance", "Doesn't have sufficient balance", colorText: Colors.red); is_joining.value = false; return; }); } else { bal = bal - fee; await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email) .update({"coins": bal}); await _db .collection("FREE FIRE") .doc("upcoming") .get() .then((value) async { eventListBgmiUpcoming = value["event"]; List temp = eventListBgmiUpcoming[index]["eventRegisteredPlayers"]; temp.add(FirebaseAuth.instance.currentUser!.email.toString()); eventListBgmiUpcoming[index]["eventRegisteredPlayers"] = temp; await _db .collection("FREE FIRE") .doc("upcoming") .update({"event": eventListBgmiUpcoming}).then((_) async { await _db .collection("FREE FIRE REGISTER LIST") .doc(dt.toString()) .get() .then((value) async { if (value.exists) { List l = value["players"]; l.add({ "player1": player1, "player2": player2, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("FREE FIRE REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .update({"players": l}).then((value) { upadteTransaction(fee); }); } else { List l = []; l.add({ "player1": player1, "player2": player2, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("FREE FIRE REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .set({"players": l}).then((value) async { upadteTransaction(fee); }); } }); }); }); } }); } if (matchType == "squad") { await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email.toString()) .get() .then((value) async { int bal = value["coins"]; if (bal < fee) { Timer(const Duration(seconds: 0), () { Get.snackbar(onTap: (snack) { Get.off(AddMoney()); }, "Low Balance", "Doesn't have sufficient balance", colorText: Colors.red); is_joining.value = false; return; }); } else { bal = bal - fee; await _db .collection("user") .doc(FirebaseAuth.instance.currentUser!.email) .update({"coins": bal}); await _db .collection("FREE FIRE") .doc("upcoming") .get() .then((value) async { eventListBgmiUpcoming = value["event"]; List temp = eventListBgmiUpcoming[index]["eventRegisteredPlayers"]; temp.add(FirebaseAuth.instance.currentUser!.email.toString()); eventListBgmiUpcoming[index]["eventRegisteredPlayers"] = temp; await _db .collection("FREE FIRE") .doc("upcoming") .update({"event": eventListBgmiUpcoming}).then((_) async { await _db .collection("FREE FIRE REGISTER LIST") .doc(dt.toString()) .get() .then((value) async { if (value.exists) { List l = value["players"]; l.add({ "player1": player1, "player2": player2, "player3": player3, "player4": player4, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("FREE FIRE REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .update({"players": l}).then((value) { upadteTransaction(fee); }); } else { List l = []; l.add({ "player1": player1, "player2": player2, "player3": player3, "player4": player4, "email": FirebaseAuth.instance.currentUser!.email.toString(), "paid": false }); await _db .collection("FREE FIRE REGISTER LIST") .doc(dt.day.toString() + dt.month.toString() + dt.year.toString() + dt.hour.toString() + dt.minute.toString() + matchType) .set({"players": l}).then((value) async { upadteTransaction(fee); }); } }); }); }); } }); } } }
0
mirrored_repositories/gamaru-mobile-app/lib
mirrored_repositories/gamaru-mobile-app/lib/Componants/background_style.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; class BackgroundStyle extends StatelessWidget { final UpperCircleColor1; final UpperCircleColor2; final LowerCircleColor1; final LowerCircleColor2; const BackgroundStyle( {super.key, required this.UpperCircleColor1, required this.UpperCircleColor2, required this.LowerCircleColor1, required this.LowerCircleColor2}); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: Stack( // mainAxisAlignment: MainAxisAlignment.start, children: [ Positioned( right: Get.width * 0.7, top: Get.height * 0.13, child: Container( height: 200, width: 200, decoration: BoxDecoration( shape: BoxShape.circle, gradient: LinearGradient( begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ UpperCircleColor1, UpperCircleColor2, ], ), ), ), ), Positioned( left: Get.width * 0.7, top: Get.height * 0.68, child: Container( height: 150, width: 150, decoration: BoxDecoration( shape: BoxShape.circle, gradient: LinearGradient( begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ LowerCircleColor1, LowerCircleColor2, ], ), ), ), ), ], ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib
mirrored_repositories/gamaru-mobile-app/lib/Componants/glossy_prof.dart
// ignore: file_names import 'dart:ui'; import 'package:flutter/material.dart'; class GlossyCardDarkProf extends StatelessWidget { // ignore: prefer_typing_uninitialized_variables final height; // ignore: prefer_typing_uninitialized_variables final width; // ignore: prefer_typing_uninitialized_variables final borderRadius; // ignore: prefer_typing_uninitialized_variables final child; // ignore: prefer_typing_uninitialized_variables final borderWith; const GlossyCardDarkProf({ super.key, required this.height, required this.width, required this.borderRadius, required this.child, required this.borderWith, }); @override Widget build(BuildContext context) { return ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(borderRadius), topRight: Radius.circular(borderRadius)), child: Container( height: height, width: width, color: Colors.transparent, child: Stack(children: [ BackdropFilter( filter: ImageFilter.blur( sigmaX: 50.0, sigmaY: 52.5, ), child: Container(), ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(borderRadius), topRight: Radius.circular(borderRadius)), border: Border.all( width: borderWith, color: Colors.black.withOpacity(0.43), ), gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ Color.fromARGB(255, 19, 2, 31).withOpacity(0.353), Color.fromARGB(255, 15, 0, 18).withOpacity(0.203), ])), ), Center( child: Container( child: child, ), ) ]), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib
mirrored_repositories/gamaru-mobile-app/lib/Componants/glossyExtra.dart
// ignore: file_names import 'dart:ui'; import 'package:flutter/material.dart'; class GlossyCardDark extends StatelessWidget { // ignore: prefer_typing_uninitialized_variables final height; // ignore: prefer_typing_uninitialized_variables final width; // ignore: prefer_typing_uninitialized_variables final borderRadius; // ignore: prefer_typing_uninitialized_variables final child; // ignore: prefer_typing_uninitialized_variables final borderWith; const GlossyCardDark({ super.key, required this.height, required this.width, required this.borderRadius, required this.child, required this.borderWith, }); @override Widget build(BuildContext context) { return ClipRRect( borderRadius: BorderRadius.all(Radius.circular(borderRadius)), child: Container( height: height, width: width, color: Colors.transparent, child: Stack(children: [ BackdropFilter( filter: ImageFilter.blur( sigmaX: 24.0, sigmaY: 23.5, ), child: Container(), ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(borderRadius), border: Border.all( width: borderWith, color: Colors.black.withOpacity(0.43), ), gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ Color.fromARGB(255, 60, 60, 60).withOpacity(0.553), Color.fromARGB(255, 50, 50, 50).withOpacity(0.403), ])), ), Center( child: Container( child: child, ), ) ]), ), ); } }
0
mirrored_repositories/gamaru-mobile-app/lib
mirrored_repositories/gamaru-mobile-app/lib/Componants/glossyEffect.dart
// ignore: file_names import 'dart:ui'; import 'package:flutter/material.dart'; class GlossyCard extends StatelessWidget { // ignore: prefer_typing_uninitialized_variables final height; // ignore: prefer_typing_uninitialized_variables final width; // ignore: prefer_typing_uninitialized_variables final borderRadius; // ignore: prefer_typing_uninitialized_variables final child; // ignore: prefer_typing_uninitialized_variables final borderWith; const GlossyCard({ super.key, required this.height, required this.width, required this.borderRadius, required this.child, required this.borderWith, }); @override Widget build(BuildContext context) { return ClipRRect( borderRadius: BorderRadius.all(Radius.circular(borderRadius)), child: Container( height: height, width: width, color: Colors.transparent, child: Stack(children: [ BackdropFilter( filter: ImageFilter.blur( sigmaX: 24.0, sigmaY: 23.5, ), child: Container(), ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(borderRadius), border: Border.all( width: borderWith, color: Colors.white.withOpacity(0.43), ), gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ Color.fromARGB(255, 107, 106, 106).withOpacity(0.153), Color.fromARGB(255, 88, 88, 88).withOpacity(0.103), ])), ), Center( child: Container( child: child, ), ) ]), ), ); } }
0
mirrored_repositories/gamaru-mobile-app
mirrored_repositories/gamaru-mobile-app/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:gamaru_mobile_app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/infinite_parking
mirrored_repositories/infinite_parking/lib/main.dart
import 'package:flutter/material.dart'; import 'package:coletiv_infinite_parking/page/splash.dart'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Infinite Parking', theme: new ThemeData( primarySwatch: Colors.blue, ), home: new SplashPage(), ); } }
0
mirrored_repositories/infinite_parking/lib
mirrored_repositories/infinite_parking/lib/network/network.dart
import 'dart:async'; import 'dart:convert'; import 'package:coletiv_infinite_parking/data/model/auth_token.dart'; import 'package:coletiv_infinite_parking/data/model/fare.dart'; import 'package:coletiv_infinite_parking/data/model/fare_cost.dart'; import 'package:coletiv_infinite_parking/data/model/municipal.dart'; import 'package:coletiv_infinite_parking/data/model/municipal_zone.dart'; import 'package:coletiv_infinite_parking/data/model/session.dart'; import 'package:coletiv_infinite_parking/data/model/vehicle.dart'; import 'package:coletiv_infinite_parking/data/session_manager.dart'; import 'package:http/http.dart' as http; final network = _Network._internal(); DateTime retryDate; class _Network { _Network._internal(); final _baseUrl = 'https://eos.empark.com/api/v1.0'; Future<Map<String, String>> _getHeaders() async { Map<String, String> headers = { 'Content-Type': 'application/json', 'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36', 'X-EOS-CLIENT-TOKEN': '2463bc87-6e92-480e-a56b-4260ff8b6a38' }; final authToken = await sessionManager.getAuthToken(); if (authToken != null) { headers["X-EOS-USER-TOKEN"] = authToken.userSessionToken; } final int provider = await sessionManager.getProvider(); if (provider == 0) { // Via Verde headers["X-EOS-CLIENT-TOKEN"] = "2463bc87-6e92-480e-a56b-4260ff8b6a38"; } else if (provider == 1) { // Telpark headers["X-EOS-CLIENT-TOKEN"] = "4cc77160-4458-4f0d-a1f1-551d70daded0"; } return headers; } // AUTHENTICATION Future<bool> login(String email, String password, int provider) async { if (!await sessionManager.saveProvider(provider)) { return false; } final loginUrl = '$_baseUrl/auth/accounts'; final body = json.encode({'username': email, 'password': password}); final response = await http.post( loginUrl, headers: await _getHeaders(), body: body, ); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { AuthToken authToken = AuthToken.fromJson(json.decode(responseBody)); return await sessionManager.saveSession(authToken, email, password); } else { throw Exception("Authentication failed"); } } Future<bool> refreshToken() async { final loginUrl = '$_baseUrl/auth/accounts'; final email = await sessionManager.getEmail(); final password = await sessionManager.getPassword(); await sessionManager.deleteSession(); if (email == null || password == null) { return false; } final body = json.encode({'username': email, 'password': password}); final response = await http.post( loginUrl, headers: await _getHeaders(), body: body, ); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { AuthToken authToken = AuthToken.fromJson(json.decode(responseBody)); return await sessionManager.saveSession(authToken, email, password); } else { return false; } } Future<bool> _canRetry(String responseBody) async { // Checks if a retry was performed in the last 5 minutes if (retryDate != null && DateTime.now().difference(retryDate).inMinutes < 5) { return false; } // Checks if the request failed because of a invalid token if (!responseBody.contains("authenticationFailed") || !responseBody.contains("invalid token")) { return false; } retryDate = DateTime.now(); // Refreshes the user token final isLoggedIn = await refreshToken(); // If the user token was refreshed successfully we can perform a retry if (isLoggedIn) { return true; } else { return false; } } // PARKING SESSION Future<List<Session>> getSessions() async { final authToken = await sessionManager.getAuthToken(); final accountToken = authToken.accountToken; final sessionsUrl = '$_baseUrl/parking/sessions?account=$accountToken&session_state=ACTIVE'; final response = await http.get( sessionsUrl, headers: await _getHeaders(), ); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { Iterable responseJson = json.decode(responseBody); return responseJson.map((object) => Session.fromJson(object)).toList(); } else if (await _canRetry(responseBody)) { return await getSessions(); } else { throw Exception("Couldn't get sessions"); } } Future<Session> addSession( Vehicle vehicle, MunicipalZone zone, Fare fare) async { final AuthToken authToken = await sessionManager.getAuthToken(); final String accountToken = authToken.accountToken; final DateTime selectedTime = await sessionManager.getSelectedTime(); final List<FareCost> selectedFares = fare.getSelectedFares(selectedTime); if (selectedTime == null || DateTime.now().isAfter(selectedTime) || selectedFares.isEmpty) { return null; } final FareCost fareCost = selectedFares.first; final body = json.encode({ 'account_token': accountToken, 'cost_time_pair': { 'cost': fareCost.cost, 'charged_duration_ms': fareCost.chargedDuration, }, 'plate': { 'id': vehicle.number, 'type': vehicle.country, }, 'position_token': zone.token, 'promise_token': fare.promiseToken, 'type': 'MANAGED' }); final addSessionUrl = '$_baseUrl/parking/sessions/'; final response = await http.post( addSessionUrl, headers: await _getHeaders(), body: body, ); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { return Session.fromJson(json.decode(responseBody)); } else if (await _canRetry(responseBody)) { return await addSession(vehicle, zone, fare); } else { throw Exception("Couldn't create session"); } } Future<Session> refreshSession(Fare fare) async { final AuthToken authToken = await sessionManager.getAuthToken(); final String accountToken = authToken.accountToken; final Vehicle vehicle = await sessionManager.getSelectedVehicle(); final String zoneToken = await sessionManager.getSelectedZoneToken(); final DateTime selectedTime = await sessionManager.getSelectedTime(); final List<FareCost> selectedFares = fare.getSelectedFares(selectedTime); if (vehicle == null || zoneToken == null || selectedTime == null || DateTime.now().isAfter(selectedTime) || selectedFares.isEmpty) { return null; } final FareCost fareCost = selectedFares.first; final body = json.encode({ 'account_token': accountToken, 'cost_time_pair': { 'cost': fareCost.cost, 'charged_duration_ms': fareCost.chargedDuration, }, 'plate': { 'id': vehicle.number, 'type': vehicle.country, }, 'position_token': zoneToken, 'promise_token': fare.promiseToken, 'type': 'MANAGED' }); final addSessionUrl = '$_baseUrl/parking/sessions/'; final response = await http.post( addSessionUrl, headers: await _getHeaders(), body: body, ); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { return Session.fromJson(json.decode(responseBody)); } else if (await _canRetry(responseBody)) { return await refreshSession(fare); } else { throw Exception("Couldn't create session"); } } Future<bool> endSession() async { final Session session = await sessionManager.getParkingSession(); if (session == null || session.token == null) { return false; } final String sessionToken = session.token; final endSessionUrl = '$_baseUrl/parking/sessions/$sessionToken/end/'; final response = await http.post(endSessionUrl, headers: await _getHeaders()); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { return true; } else if (await _canRetry(responseBody)) { return await endSession(); } else { throw Exception("Couldn't create session"); } } // VEHICLE Future<List<Vehicle>> getVehicles() async { final authToken = await sessionManager.getAuthToken(); final accountToken = authToken.accountToken; final vehiclesUrl = '$_baseUrl/accounts/$accountToken/vehicles/'; final response = await http.get( vehiclesUrl, headers: await _getHeaders(), ); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { Iterable responseJson = json.decode(responseBody); return responseJson.map((object) => Vehicle.fromJson(object)).toList(); } else if (await _canRetry(responseBody)) { return await getVehicles(); } else { throw Exception("Couldn't get vehicles"); } } // MUNICIPALS Future<List<Municipal>> getMunicipals() async { final municipalUrl = '$_baseUrl/centers/services?type=MUNICIPAL_CONTEXT'; final response = await http.get( municipalUrl, headers: await _getHeaders(), ); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { Iterable responseJson = json.decode(responseBody)['result']; return responseJson.map((object) => Municipal.fromJson(object)).toList(); } else if (await _canRetry(responseBody)) { return await getMunicipals(); } else { throw Exception("Couldn't get municipals"); } } Future<List<MunicipalZone>> getMunicipalZones(String municipalToken) async { final zoneUrl = '$_baseUrl/geo/search?context_token=$municipalToken&polygon_info=true'; final response = await http.get( zoneUrl, headers: await _getHeaders(), ); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { Iterable responseJson = json.decode(responseBody)['result']; return responseJson .map((object) => MunicipalZone.fromJson(object)) .toList(); } else if (await _canRetry(responseBody)) { return await getMunicipalZones(municipalToken); } else { throw Exception("Couldn't get zones"); } } // FARES Future<Fare> getFare(Vehicle vehicle, String zoneToken) async { final authToken = await sessionManager.getAuthToken(); final accountToken = authToken.accountToken; final fareUrl = '$_baseUrl/parking/fares/table/'; final body = json.encode({ 'account_token': accountToken, 'type': 'MANAGED', 'position_token': zoneToken, 'dtStart': {'date': DateTime.now().toIso8601String()}, 'plate': {'id': vehicle.number, 'type': 'PT'} }); final response = await http.post( fareUrl, headers: await _getHeaders(), body: body, ); final responseBody = utf8.decode(response.bodyBytes); if (response.statusCode == 200) { return Fare.fromJson(json.decode(responseBody)); } else if (await _canRetry(responseBody)) { return await getFare(vehicle, zoneToken); } else { throw Exception("Couldn't get fares"); } } }
0
mirrored_repositories/infinite_parking/lib/network
mirrored_repositories/infinite_parking/lib/network/client/auth_client.dart
import 'dart:async'; import 'package:coletiv_infinite_parking/network/network.dart'; final authClient = _AuthClient._internal(); class _AuthClient { _AuthClient._internal(); Future<bool> login(String email, String password, int provider) async { try { return await network.login(email, password, provider); } catch (e) { return false; } } Future<bool> refreshToken() async { return await network.refreshToken(); } }
0
mirrored_repositories/infinite_parking/lib/network
mirrored_repositories/infinite_parking/lib/network/client/fare_client.dart
import 'dart:async'; import 'package:coletiv_infinite_parking/data/model/fare.dart'; import 'package:coletiv_infinite_parking/data/model/municipal_zone.dart'; import 'package:coletiv_infinite_parking/data/model/vehicle.dart'; import 'package:coletiv_infinite_parking/network/network.dart'; import 'package:coletiv_infinite_parking/data/session_manager.dart'; final fareClient = _FareClient._internal(); class _FareClient { _FareClient._internal(); Future<Fare> getFare(Vehicle vehicle, MunicipalZone zone) async { try { return await network.getFare(vehicle, zone.token); } catch (e) { return null; } } Future<Fare> getSelectedFare() async { Vehicle selectedVehicle = await sessionManager.getSelectedVehicle(); String selectedZoneToken = await sessionManager.getSelectedZoneToken(); try { return await network.getFare(selectedVehicle, selectedZoneToken); } catch (e) { return null; } } }
0
mirrored_repositories/infinite_parking/lib/network
mirrored_repositories/infinite_parking/lib/network/client/vehicle_client.dart
import 'dart:async'; import 'package:coletiv_infinite_parking/data/model/vehicle.dart'; import 'package:coletiv_infinite_parking/network/network.dart'; final vehicleClient = _VehicleClient._internal(); class _VehicleClient { _VehicleClient._internal(); Future<List<Vehicle>> getVehicles() async { try { return await network.getVehicles(); } catch (e) { return List<Vehicle>(); } } }
0
mirrored_repositories/infinite_parking/lib/network
mirrored_repositories/infinite_parking/lib/network/client/municipal_client.dart
import 'dart:async'; import 'package:coletiv_infinite_parking/data/model/municipal.dart'; import 'package:coletiv_infinite_parking/data/model/municipal_zone.dart'; import 'package:coletiv_infinite_parking/network/network.dart'; final municipalClient = _MunicipalClient._internal(); class _MunicipalClient { _MunicipalClient._internal(); Future<List<Municipal>> getMunicipals() async { try { return await network.getMunicipals(); } catch (e) { return List<Municipal>(); } } Future<List<MunicipalZone>> getMunicipalZones(String municipalToken) async { try { return await network.getMunicipalZones(municipalToken); } catch (e) { return List<MunicipalZone>(); } } }
0
mirrored_repositories/infinite_parking/lib/network
mirrored_repositories/infinite_parking/lib/network/client/session_client.dart
import 'dart:async'; import 'package:coletiv_infinite_parking/data/model/fare.dart'; import 'package:coletiv_infinite_parking/data/model/municipal_zone.dart'; import 'package:coletiv_infinite_parking/data/model/session.dart'; import 'package:coletiv_infinite_parking/data/model/vehicle.dart'; import 'package:coletiv_infinite_parking/network/network.dart'; final sessionClient = _SessionClient._internal(); class _SessionClient { _SessionClient._internal(); Future<List<Session>> getSessions() async { try { return await network.getSessions(); } catch (e) { return List<Session>(); } } Future<Session> addSession( Vehicle vehicle, MunicipalZone zone, Fare fare) async { try { return await network.addSession(vehicle, zone, fare); } catch (e) { return null; } } Future<Session> refreshSession(Fare fare) async { try { return await network.refreshSession(fare); } catch (e) { return null; } } Future<bool> endSession() async { try { return await network.endSession(); } catch (e) { return false; } } }
0
mirrored_repositories/infinite_parking/lib
mirrored_repositories/infinite_parking/lib/page/auth.dart
import 'package:flutter/material.dart'; import 'package:coletiv_infinite_parking/network/client/auth_client.dart'; import 'package:coletiv_infinite_parking/page/sessions.dart'; class AuthPage extends StatefulWidget { @override AuthPageState createState() => AuthPageState(); } class AuthPageState extends State<AuthPage> { BuildContext _context; final List<String> _authOptions = ["Via Verde", "Telpark"]; int _selectedProvider = 0; final TextEditingController _emailController = TextEditingController(); final TextEditingController _passwordController = TextEditingController(); bool _isLoading = false; void _login() async { _updateLoadingState(true); final email = _emailController.text; final password = _passwordController.text; final isLoggedIn = await authClient.login(email, password, _selectedProvider); if (isLoggedIn) { Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => SessionsPage(), ), ); } else { _showError(); } } void _showError() { _updateLoadingState(false); Scaffold.of(_context).showSnackBar( SnackBar( duration: Duration(seconds: 2), backgroundColor: Colors.red, content: Text("Authentication failed."), ), ); } void _updateLoadingState(bool isLoading) { setState(() { this._isLoading = isLoading; }); } @override void dispose() { _emailController.dispose(); _passwordController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Authentication'), ), body: Builder( builder: (BuildContext context) { _context = context; return Container( margin: EdgeInsets.symmetric(horizontal: 20.0), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( margin: EdgeInsets.only(bottom: 16.0), child: TextField( maxLines: 1, controller: _emailController, decoration: InputDecoration( hintText: 'Email', ), ), ), Container( margin: EdgeInsets.only(bottom: 16.0), child: TextField( maxLines: 1, obscureText: true, controller: _passwordController, decoration: InputDecoration(hintText: 'Password'), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ DropdownButton( items: _authOptions.map( (option) { return DropdownMenuItem( child: Text(option), value: _authOptions.indexOf(option), ); }, ).toList(), value: _selectedProvider, onChanged: (value) { setState(() { _selectedProvider = value; }); }, ), Stack( alignment: AlignmentDirectional.center, children: <Widget>[ Opacity( opacity: _isLoading ? 1.0 : 0.0, child: CircularProgressIndicator(), ), Opacity( opacity: _isLoading ? 0.0 : 1.0, child: RaisedButton( onPressed: _login, child: Text('LOGIN'), ), ), ], ) ], ), ], ), ), ); }, ), ); } }
0
mirrored_repositories/infinite_parking/lib
mirrored_repositories/infinite_parking/lib/page/sessions.dart
import 'package:flutter/material.dart'; import 'package:coletiv_infinite_parking/data/model/session.dart'; import 'package:coletiv_infinite_parking/data/session_manager.dart'; import 'package:coletiv_infinite_parking/network/client/session_client.dart'; import 'package:coletiv_infinite_parking/page/add_session.dart'; import 'package:coletiv_infinite_parking/page/auth.dart'; import 'package:coletiv_infinite_parking/service/push_notifications.dart'; import 'package:coletiv_infinite_parking/service/session_renew.dart'; class SessionsPage extends StatefulWidget { @override SessionsPageState createState() => SessionsPageState(); } class SessionsPageState extends State<SessionsPage> { @override void initState() { super.initState(); _getSessions(); } BuildContext _context; bool _isLoading = false; final List<Session> _sessions = List<Session>(); void _getSessions() async { _updateLoadingState(true); List<Session> sessions = await sessionClient.getSessions(); setState(() { _sessions.clear(); _sessions.addAll(sessions); }); _updateLoadingState(false); } void _logout() async { final isLoggedOut = await sessionManager.deleteSession(); if (isLoggedOut) { await pushNotifications.cancelAll(); await cancelSessionRenew(); Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => AuthPage(), ), ); } else { Scaffold.of(_context).showSnackBar( SnackBar( duration: Duration(seconds: 2), backgroundColor: Colors.red, content: Text("Logout failed."), ), ); } } void _showLogoutAlert() { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text("Do you want to logout?"), content: Text("You will lose all your scheduled sessions."), actions: [ FlatButton( child: Text("No"), onPressed: () => Navigator.pop(context), ), FlatButton( child: Text("Yes"), onPressed: () => _logout(), ), ], ); }, ); } void _addSession() { Navigator.push( context, MaterialPageRoute( builder: (context) => AddSessionPage(), ), ).whenComplete(() { _getSessions(); }); } void _updateLoadingState(bool isLoading) { setState(() { this._isLoading = isLoading; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Sessions'), actions: <Widget>[ IconButton( icon: Icon(Icons.refresh), onPressed: _getSessions, ), IconButton( icon: Icon(Icons.exit_to_app), onPressed: _showLogoutAlert, ) ], ), body: Builder( builder: (context) { _context = context; return Stack( alignment: AlignmentDirectional.center, children: <Widget>[ Opacity( opacity: _isLoading ? 1.0 : 0.0, child: CircularProgressIndicator(), ), Opacity( opacity: !_isLoading && _sessions.isEmpty ? 1.0 : 0.0, child: Text( "You have no active sessions.", textAlign: TextAlign.center, ), ), Opacity( opacity: !_isLoading && _sessions.isNotEmpty ? 1.0 : 0.0, child: ListView.builder( itemCount: _sessions.length, itemBuilder: (context, index) { Session session = _sessions[index]; return ListTile( title: Text( session.getPlate(), ), subtitle: Text( "Ends at: ${session.getFormattedFinalDate()}", ), ); }, ), ), ], ); }, ), floatingActionButton: FloatingActionButton( child: Icon(Icons.add), onPressed: _addSession, ), ); } }
0
mirrored_repositories/infinite_parking/lib
mirrored_repositories/infinite_parking/lib/page/add_session.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:coletiv_infinite_parking/data/model/session.dart'; import 'package:coletiv_infinite_parking/data/model/fare.dart'; import 'package:coletiv_infinite_parking/data/model/municipal.dart'; import 'package:coletiv_infinite_parking/data/model/municipal_zone.dart'; import 'package:coletiv_infinite_parking/data/model/vehicle.dart'; import 'package:coletiv_infinite_parking/data/session_manager.dart'; import 'package:coletiv_infinite_parking/network/client/fare_client.dart'; import 'package:coletiv_infinite_parking/network/client/session_client.dart'; import 'package:coletiv_infinite_parking/service/session_renew.dart'; import 'package:coletiv_infinite_parking/widget/dialog/select_municipal_dialog.dart'; import 'package:coletiv_infinite_parking/widget/dialog/select_vehicle_dialog.dart'; import 'package:coletiv_infinite_parking/widget/dialog/select_zone_dialog.dart'; class AddSessionPage extends StatefulWidget { @override State createState() => AddSessionPageState(); } class AddSessionPageState extends State<AddSessionPage> { BuildContext _context; Vehicle _selectedVehicle; Municipal _selectedMunicipal; MunicipalZone _selectedZone; DateTime _selectedTime; Fare _fare; bool _isLoadingFares = false; void _getFares() async { if (_selectedVehicle == null || _selectedZone == null) { return; } setState(() { _isLoadingFares = true; }); _fare = await fareClient.getFare(_selectedVehicle, _selectedZone); setState(() { _isLoadingFares = false; }); } void _addSession() async { bool isParkingSessionSaved = await sessionManager.saveSelectedParkingSession( _selectedVehicle, _selectedZone, _selectedTime, ); if (!isParkingSessionSaved) { _showError("Some problem happened while creating your parking session"); return; } Session parkingSession = await sessionClient.addSession( _selectedVehicle, _selectedZone, _fare, ); if (parkingSession == null) { _showError("Some problem happened while creating your parking session"); } else { await sessionManager.saveParkingSession(parkingSession); scheduleSessionRenew(parkingSession); Navigator.pop(context); } } void _validateInput() { if (_selectedVehicle == null) { _showError("Please choose your Vehicle first!"); } else if (_selectedMunicipal == null) { _showError("Please select a Municipal first!"); } else if (_selectedZone == null) { _showError("Please select a Zone first!"); } else if (_fare == null || _selectedTime == null) { _showError("Please select a Time first!"); } else { _addSession(); } } void _showError(String errorMessage) { Scaffold.of(_context).showSnackBar( SnackBar( duration: Duration(seconds: 2), backgroundColor: Colors.red, content: Text(errorMessage), ), ); } Future _selectVehicle() async { Vehicle vehicle = await Navigator.push( context, MaterialPageRoute<Vehicle>( builder: (BuildContext context) { return SelectVehicleDialog(selectedVehicle: _selectedVehicle); }, fullscreenDialog: true, ), ); if (vehicle != null) { _onVehicleSelected(vehicle); } } void _onVehicleSelected(Vehicle vehicle) { setState(() { if (_selectedVehicle != null && _selectedVehicle.token != vehicle.token) { _fare = null; } _selectedVehicle = vehicle; }); _getFares(); } Future _selectMunicipal() async { Municipal municipal = await Navigator.push( context, MaterialPageRoute<Municipal>( builder: (BuildContext context) { return SelectMunicipalDialog(selectedMunicipal: _selectedMunicipal); }, fullscreenDialog: true, ), ); if (municipal != null) { _onMunicipalSelected(municipal); } } void _onMunicipalSelected(Municipal municipal) { setState(() { if (_selectedMunicipal != null && _selectedMunicipal.token != municipal.token) { _selectedZone = null; _fare = null; } _selectedMunicipal = municipal; }); } void _selectZone() { if (_selectedMunicipal == null) { _showError("Please select a Municipal first!"); } else { _showZoneSelectionDialog(); } } Future _showZoneSelectionDialog() async { MunicipalZone zone = await Navigator.push( context, MaterialPageRoute<MunicipalZone>( builder: (BuildContext context) { return SelectZoneDialog( selectedMunicipal: _selectedMunicipal, selectedZone: _selectedZone, ); }, fullscreenDialog: true, ), ); if (zone != null) { _onZoneSelected(zone); } } void _onZoneSelected(MunicipalZone zone) { setState(() { if (_selectedZone != null && _selectedZone.token != zone.token) { _fare = null; } _selectedZone = zone; }); _getFares(); } void _selectTime() { if (_selectedVehicle == null) { _showError("Please choose your Vehicle first!"); } else if (_selectedZone == null) { _showError("Please select a Zone first!"); } else { _showTimeSelectionDialog(); } } Future _showTimeSelectionDialog() async { TimeOfDay time = await showTimePicker( context: context, initialTime: TimeOfDay.now(), ); if (time != null) { _onTimeSelected(time); } } void _onTimeSelected(TimeOfDay time) { DateTime currentDate = DateTime.now(); DateTime selectedTime = DateTime( currentDate.year, currentDate.month, currentDate.day, time.hour, time.minute, ); if (!_isSelectedTimeValid(selectedTime)) { return; } setState(() { _selectedTime = selectedTime; }); } bool _isSelectedTimeValid(DateTime selectedTime) { DateTime currentDate = DateTime.now(); // After 19:00 it's not possible to schedule a session if (selectedTime.hour > 19) { _showError("Please select a time before 19:00"); return false; } // A session cannot be scheduled to the past if (selectedTime.hour < currentDate.hour) { _showError("Please select a time after the current time"); return false; } // A session cannot be scheduled to the past if (selectedTime.hour == currentDate.hour && selectedTime.minute < currentDate.minute) { _showError("Please select a time after the current time"); return false; } int minimumDuration = _fare.getMinimumDuration().inMinutes; int selectedDuration = selectedTime.difference(currentDate).inMinutes; // A schedule as a minimum duration if (selectedDuration < minimumDuration) { _showError("${minimumDuration}m is the minimum duration for this zone"); return false; } return true; } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Add Session'), actions: <Widget>[ IconButton( icon: Icon(Icons.add_box), onPressed: _validateInput, ) ], ), body: Builder( builder: (BuildContext context) { _context = context; return ListView( children: <Widget>[ ListTile( title: Text("Vehicle"), trailing: Icon(Icons.arrow_right), subtitle: Text(_selectedVehicle != null ? _selectedVehicle.number : "Select vehicle"), onTap: _selectVehicle, ), ListTile( title: Text("Municipal"), trailing: Icon(Icons.arrow_right), subtitle: Text(_selectedMunicipal != null ? _selectedMunicipal.name : "Select municipal"), onTap: _selectMunicipal, ), ListTile( title: Text("Zone"), trailing: Icon(Icons.arrow_right), subtitle: Text( _selectedZone != null ? _selectedZone.name : "Select zone"), onTap: _selectZone, ), Builder( builder: (BuildContext context) { if (_isLoadingFares) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ CircularProgressIndicator(), ], ); } else { return ListTile( title: Text("Time"), trailing: Icon(Icons.arrow_right), subtitle: Text(_fare != null && _selectedTime != null ? "${_fare.getFormattedSessionCost(_selectedTime)} - ${_fare.getFormattedSessionExpirationTime(_selectedTime)}" : "Select time"), onTap: _selectTime, ); } }, ), ], ); }, ), ); } }
0
mirrored_repositories/infinite_parking/lib
mirrored_repositories/infinite_parking/lib/page/splash.dart
import 'package:flutter/material.dart'; import 'package:coletiv_infinite_parking/data/session_manager.dart'; import 'package:coletiv_infinite_parking/network/client/auth_client.dart'; import 'package:coletiv_infinite_parking/page/sessions.dart'; import 'package:coletiv_infinite_parking/page/auth.dart'; import 'package:coletiv_infinite_parking/service/push_notifications.dart'; import 'package:android_alarm_manager/android_alarm_manager.dart'; class SplashPage extends StatefulWidget { @override SplashPageState createState() => SplashPageState(); } class SplashPageState extends State<SplashPage> { @override void initState() { super.initState(); _login(); } void _login() async { await AndroidAlarmManager.initialize(); await pushNotifications.initialize(); final isLoggedIn = await authClient.refreshToken(); _redirectUser(isLoggedIn); } void _redirectUser(bool isLoggedIn) { if (isLoggedIn) { Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => SessionsPage(), ), ); } else { sessionManager.deleteSession(); pushNotifications.cancelAll(); Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => AuthPage(), ), ); } } @override Widget build(BuildContext context) { return Container( color: Colors.white, child: Center( child: CircularProgressIndicator(), ), ); } }
0
mirrored_repositories/infinite_parking/lib
mirrored_repositories/infinite_parking/lib/data/session_manager.dart
import 'dart:async'; import 'dart:convert'; import 'package:coletiv_infinite_parking/data/model/auth_token.dart'; import 'package:coletiv_infinite_parking/data/model/municipal_zone.dart'; import 'package:coletiv_infinite_parking/data/model/session.dart'; import 'package:coletiv_infinite_parking/data/model/vehicle.dart'; import 'package:shared_preferences/shared_preferences.dart'; final sessionManager = _SessionManager._internal(); class _SessionManager { _SessionManager._internal(); final String _authTokenKey = 'AuthToken'; final String _emailKey = "Email"; final String _passwordKey = "Password"; final String _providerKey = "Provider"; final String _selectedVehicleKey = "SelectedVehicle"; final String _selectedZoneTokenKey = "SelectedZoneToken"; final String _selectedTimeKey = "SelectedTimeToken"; final String _parkingSessionKey = "ParkingSession"; Future<SharedPreferences> _getPrefs() async => await SharedPreferences.getInstance(); // User Session Future<bool> _saveAuthToken(AuthToken authToken) async { final String authTokenJson = json.encode(authToken); return await _getPrefs() .then((prefs) => prefs.setString(_authTokenKey, authTokenJson)); } Future<bool> _saveEmail(String email) async { return await _getPrefs().then((prefs) => prefs.setString(_emailKey, email)); } Future<bool> _savePassword(String password) async { return await _getPrefs() .then((prefs) => prefs.setString(_passwordKey, password)); } Future<bool> saveProvider(int provider) async { return await _getPrefs() .then((prefs) => prefs.setInt(_providerKey, provider)); } Future<bool> saveSession( AuthToken authToken, String email, String password) async { return Future.wait([ _saveAuthToken(authToken), _saveEmail(email), _savePassword(password), ]).then((_) => true).catchError(() => false); } Future<AuthToken> getAuthToken() async { final String authTokenJson = await _getPrefs().then((prefs) => prefs.get(_authTokenKey)); if (authTokenJson == null) { return null; } else { return AuthToken.fromJson(json.decode(authTokenJson)); } } Future<String> getEmail() async => await _getPrefs().then((prefs) => prefs.get(_emailKey)); Future<String> getPassword() async => await _getPrefs().then((prefs) => prefs.get(_passwordKey)); Future<int> getProvider() async => await _getPrefs().then((prefs) => prefs.get(_providerKey)); Future<bool> deleteSession() async => await _getPrefs().then((prefs) => prefs.clear()); Future<bool> isLoggedIn() async { final AuthToken authToken = await getAuthToken(); return authToken != null ? true : false; } // Parking Session Future<bool> _saveSelectedVehicle(Vehicle vehicle) async { final String vehicleJson = json.encode(vehicle); return await _getPrefs() .then((prefs) => prefs.setString(_selectedVehicleKey, vehicleJson)); } Future<bool> _saveSelectedZoneToken(MunicipalZone zone) async { return await _getPrefs() .then((prefs) => prefs.setString(_selectedZoneTokenKey, zone.token)); } Future<bool> _saveSelectedTime(DateTime time) async { return await _getPrefs().then( (prefs) => prefs.setString(_selectedTimeKey, time.toIso8601String())); } Future<bool> saveSelectedParkingSession( Vehicle vehicle, MunicipalZone zone, DateTime time) async { return Future.wait([ _saveSelectedVehicle(vehicle), _saveSelectedZoneToken(zone), _saveSelectedTime(time), ]).then((_) => true).catchError(() => false); } Future<bool> saveParkingSession(Session session) async { final String sessionJson = json.encode(session); return await _getPrefs() .then((prefs) => prefs.setString(_parkingSessionKey, sessionJson)); } Future<bool> deleteParkingSession() async { return await _getPrefs().then((prefs) { Future.wait([ prefs.setString(_selectedVehicleKey, null), prefs.setString(_selectedZoneTokenKey, null), prefs.setString(_selectedTimeKey, null), prefs.setString(_parkingSessionKey, null) ]).then((_) => true).catchError(() => false); }); } Future<Vehicle> getSelectedVehicle() async { final String vehicleJson = await _getPrefs().then((prefs) => prefs.get(_selectedVehicleKey)); if (vehicleJson == null) { return null; } else { return Vehicle.fromJson(json.decode(vehicleJson)); } } Future<String> getSelectedZoneToken() async => await _getPrefs().then((prefs) => prefs.get(_selectedZoneTokenKey)); Future<DateTime> getSelectedTime() async { String selectedTimeString = await _getPrefs().then((prefs) => prefs.get(_selectedTimeKey)); return DateTime.tryParse(selectedTimeString); } Future<Session> getParkingSession() async { final String sessionJson = await _getPrefs().then((prefs) => prefs.get(_parkingSessionKey)); if (sessionJson == null) { return null; } else { return Session.fromJson(json.decode(sessionJson)); } } }
0