repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/flutterflow_ecommerce_app/lib/category
mirrored_repositories/flutterflow_ecommerce_app/lib/category/filter_app_bar/filter_app_bar_model.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'filter_app_bar_widget.dart' show FilterAppBarWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class FilterAppBarModel extends FlutterFlowModel<FilterAppBarWidget> { /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/category
mirrored_repositories/flutterflow_ecommerce_app/lib/category/filter_app_bar/filter_app_bar_widget.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'filter_app_bar_model.dart'; export 'filter_app_bar_model.dart'; class FilterAppBarWidget extends StatefulWidget { const FilterAppBarWidget({Key? key}) : super(key: key); @override _FilterAppBarWidgetState createState() => _FilterAppBarWidgetState(); } class _FilterAppBarWidgetState extends State<FilterAppBarWidget> { late FilterAppBarModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => FilterAppBarModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Container( width: double.infinity, height: 42.0, decoration: BoxDecoration(), child: Stack( children: [ Container( width: double.infinity, height: 40.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).primary, FlutterFlowTheme.of(context).secondary ], stops: [0.0, 1.0], begin: AlignmentDirectional(-1.0, 0.0), end: AlignmentDirectional(1.0, 0), ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { context.safePop(); }, child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/back.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ), Expanded( child: Align( alignment: AlignmentDirectional(0.0, 0.0), child: Text( 'Filter', style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Display', color: FlutterFlowTheme.of(context) .secondaryBackground, fontSize: 19.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ), Text( 'Clear', style: FlutterFlowTheme.of(context).titleMedium, ), ], ), ), ], ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/category
mirrored_repositories/flutterflow_ecommerce_app/lib/category/filters/filters_model.dart
import '/backend/backend.dart'; import '/category/filter_app_bar/filter_app_bar_widget.dart'; import '/flutter_flow/flutter_flow_drop_down.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_widgets.dart'; import '/flutter_flow/form_field_controller.dart'; import '/custom_code/widgets/index.dart' as custom_widgets; import 'filters_widget.dart' show FiltersWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class FiltersModel extends FlutterFlowModel<FiltersWidget> { /// State fields for stateful widgets in this page. final unfocusNode = FocusNode(); // Model for filterAppBar component. late FilterAppBarModel filterAppBarModel; // State field(s) for CategoriesDown widget. String? categoriesDownValue; FormFieldController<String>? categoriesDownValueController; // State field(s) for BrandsDown widget. List<String>? brandsDownValue; FormFieldController<String>? brandsDownValueController; // State field(s) for SortByDown widget. String? sortByDownValue; FormFieldController<String>? sortByDownValueController; /// Initialization and disposal methods. void initState(BuildContext context) { filterAppBarModel = createModel(context, () => FilterAppBarModel()); } void dispose() { unfocusNode.dispose(); filterAppBarModel.dispose(); } /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/category
mirrored_repositories/flutterflow_ecommerce_app/lib/category/filters/filters_widget.dart
import '/backend/backend.dart'; import '/category/filter_app_bar/filter_app_bar_widget.dart'; import '/flutter_flow/flutter_flow_drop_down.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_widgets.dart'; import '/flutter_flow/form_field_controller.dart'; import '/custom_code/widgets/index.dart' as custom_widgets; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'filters_model.dart'; export 'filters_model.dart'; class FiltersWidget extends StatefulWidget { const FiltersWidget({Key? key}) : super(key: key); @override _FiltersWidgetState createState() => _FiltersWidgetState(); } class _FiltersWidgetState extends State<FiltersWidget> { late FiltersModel _model; final scaffoldKey = GlobalKey<ScaffoldState>(); @override void initState() { super.initState(); _model = createModel(context, () => FiltersModel()); } @override void dispose() { _model.dispose(); super.dispose(); } @override Widget build(BuildContext context) { if (isiOS) { SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle( statusBarBrightness: Theme.of(context).brightness, systemStatusBarContrastEnforced: true, ), ); } context.watch<FFAppState>(); return GestureDetector( onTap: () => _model.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(_model.unfocusNode) : FocusScope.of(context).unfocus(), child: Scaffold( key: scaffoldKey, backgroundColor: FlutterFlowTheme.of(context).secondaryBackground, appBar: FFAppState().pageNumber != 4 ? AppBar( automaticallyImplyLeading: false, actions: [], flexibleSpace: FlexibleSpaceBar( background: Container( width: 100.0, height: 100.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).primary, FlutterFlowTheme.of(context).secondary ], stops: [0.0, 1.0], begin: AlignmentDirectional(-1.0, 0.0), end: AlignmentDirectional(1.0, 0), ), ), ), ), centerTitle: false, elevation: 0.0, ) : null, body: SafeArea( top: true, child: Column( mainAxisSize: MainAxisSize.min, children: [ wrapWithModel( model: _model.filterAppBarModel, updateCallback: () => setState(() {}), child: FilterAppBarWidget(), ), Flexible( child: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration(), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0), child: ListView( padding: EdgeInsets.zero, shrinkWrap: true, scrollDirection: Axis.vertical, children: [ Align( alignment: AlignmentDirectional(-1.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 0.0, 8.0), child: Text( 'Price', style: FlutterFlowTheme.of(context).labelLarge, ), ), ), Container( width: 395.0, height: 100.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context) .secondaryBackground, ), child: Container( width: 100.0, height: 24.0, child: custom_widgets.RangeSliderWidget( width: 100.0, height: 24.0, start: 0.0, end: 800.0, activeColor: FlutterFlowTheme.of(context).accent1, inactiveColor: FlutterFlowTheme.of(context).alternate, trackheight: 4.0, onChanged: () async { setState(() {}); }, ), ), ), Container( height: 48.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).info, borderRadius: BorderRadius.circular(8.0), border: Border.all( color: FlutterFlowTheme.of(context).alternate, ), ), child: Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Text( '\$${valueOrDefault<String>( FFAppState().filterPriceLower.toString(), '0', )}', style: FlutterFlowTheme.of(context).bodyMedium, ), SizedBox( height: 100.0, child: VerticalDivider( thickness: 1.0, color: FlutterFlowTheme.of(context).alternate, ), ), Text( '\$${valueOrDefault<String>( FFAppState().filterPriceHigher.toString(), '100', )}', style: FlutterFlowTheme.of(context).bodyMedium, ), ], ), ), Align( alignment: AlignmentDirectional(-1.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 24.0, 0.0, 8.0), child: Text( 'Categories', style: FlutterFlowTheme.of(context).labelLarge, ), ), ), StreamBuilder<List<ProductTypeRecord>>( stream: queryProductTypeRecord(), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<ProductTypeRecord> categoriesDownProductTypeRecordList = snapshot.data!; return FlutterFlowDropDown<String>( controller: _model.categoriesDownValueController ??= FormFieldController<String>(null), options: categoriesDownProductTypeRecordList .map((e) => e.name) .toList(), onChanged: (val) => setState( () => _model.categoriesDownValue = val), width: double.infinity, height: 50.0, textStyle: FlutterFlowTheme.of(context).bodyMedium, hintText: 'Please select category...', icon: Icon( Icons.arrow_forward_ios_rounded, color: FlutterFlowTheme.of(context).secondaryText, size: 24.0, ), fillColor: FlutterFlowTheme.of(context) .secondaryBackground, elevation: 2.0, borderColor: FlutterFlowTheme.of(context).alternate, borderWidth: 2.0, borderRadius: 8.0, margin: EdgeInsetsDirectional.fromSTEB( 16.0, 4.0, 16.0, 4.0), hidesUnderline: true, isSearchable: false, isMultiSelect: false, ); }, ), Align( alignment: AlignmentDirectional(-1.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 24.0, 0.0, 8.0), child: Text( 'Brand', style: FlutterFlowTheme.of(context).labelLarge, ), ), ), StreamBuilder<List<BrandsRecord>>( stream: queryBrandsRecord(), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<BrandsRecord> brandsDownBrandsRecordList = snapshot.data!; return FlutterFlowDropDown<String>( controller: _model.brandsDownValueController ??= FormFieldController<String>(null), options: brandsDownBrandsRecordList .map((e) => e.name) .toList(), onChanged: null, width: double.infinity, height: 50.0, textStyle: FlutterFlowTheme.of(context).bodyMedium, hintText: 'Please select brand...', icon: Icon( Icons.arrow_forward_ios_rounded, color: FlutterFlowTheme.of(context).secondaryText, size: 24.0, ), fillColor: FlutterFlowTheme.of(context) .secondaryBackground, elevation: 2.0, borderColor: FlutterFlowTheme.of(context).alternate, borderWidth: 2.0, borderRadius: 8.0, margin: EdgeInsetsDirectional.fromSTEB( 16.0, 4.0, 16.0, 4.0), hidesUnderline: true, isSearchable: false, isMultiSelect: true, onChangedForMultiSelect: (val) async { setState(() => _model.brandsDownValue = val); setState(() { FFAppState().filterBrands = _model .brandsDownValue! .toList() .cast<String>(); }); }, ); }, ), Align( alignment: AlignmentDirectional(-1.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 24.0, 0.0, 8.0), child: Text( 'Colors', style: FlutterFlowTheme.of(context).labelLarge, ), ), ), Container( width: double.infinity, height: 50.0, decoration: BoxDecoration(), child: StreamBuilder<List<ColorsRecord>>( stream: queryColorsRecord(), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<ColorsRecord> listViewColorsRecordList = snapshot.data!; return ListView.separated( padding: EdgeInsets.zero, shrinkWrap: true, scrollDirection: Axis.horizontal, itemCount: listViewColorsRecordList.length, separatorBuilder: (_, __) => SizedBox(width: 16.0), itemBuilder: (context, listViewIndex) { final listViewColorsRecord = listViewColorsRecordList[listViewIndex]; return Container( decoration: BoxDecoration( shape: BoxShape.circle, ), child: Builder( builder: (context) { if (FFAppState().filterColors.contains( listViewColorsRecord.color)) { return InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { setState(() { FFAppState() .removeFromFilterColors( listViewColorsRecord .color!); FFAppState() .removeFromFilterColorIds( listViewColorsRecord .reference); }); }, child: Container( width: 47.0, height: 47.0, decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( color: FlutterFlowTheme.of( context) .accent1, width: 3.0, ), ), child: Align( alignment: AlignmentDirectional( 0.0, 0.0), child: Padding( padding: EdgeInsets.all(4.0), child: Container( width: 40.0, height: 40.0, decoration: BoxDecoration( color: listViewColorsRecord .color, shape: BoxShape.circle, ), ), ), ), ), ); } else { return Padding( padding: EdgeInsets.all(4.0), child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { setState(() { FFAppState() .addToFilterColors( listViewColorsRecord .color!); FFAppState() .addToFilterColorIds( listViewColorsRecord .reference); }); }, child: Container( width: 47.0, height: 47.0, decoration: BoxDecoration( color: listViewColorsRecord .color, shape: BoxShape.circle, border: Border.all( color: Colors.transparent, width: 3.0, ), ), ), ), ); } }, ), ); }, ); }, ), ), Align( alignment: AlignmentDirectional(-1.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 24.0, 0.0, 8.0), child: Text( 'Sort by', style: FlutterFlowTheme.of(context).labelLarge, ), ), ), StreamBuilder<List<ProductTypeRecord>>( stream: queryProductTypeRecord(), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<ProductTypeRecord> sortByDownProductTypeRecordList = snapshot.data!; return FlutterFlowDropDown<String>( controller: _model.sortByDownValueController ??= FormFieldController<String>(null), options: sortByDownProductTypeRecordList .map((e) => e.name) .toList(), onChanged: (val) => setState(() => _model.sortByDownValue = val), width: double.infinity, height: 50.0, textStyle: FlutterFlowTheme.of(context).bodyMedium, hintText: 'Please select sorting...', icon: Icon( Icons.arrow_forward_ios_rounded, color: FlutterFlowTheme.of(context).secondaryText, size: 24.0, ), fillColor: FlutterFlowTheme.of(context) .secondaryBackground, elevation: 2.0, borderColor: FlutterFlowTheme.of(context).alternate, borderWidth: 2.0, borderRadius: 8.0, margin: EdgeInsetsDirectional.fromSTEB( 16.0, 4.0, 16.0, 4.0), hidesUnderline: true, isSearchable: false, isMultiSelect: false, ); }, ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 32.0, 0.0, 20.0), child: FutureBuilder<int>( future: queryProductsRecordCount( queryBuilder: (productsRecord) => productsRecord .where( 'price', isGreaterThanOrEqualTo: FFAppState() .filterPriceLower .toDouble(), ) .where( 'price', isLessThanOrEqualTo: FFAppState() .filterPriceHigher .toDouble(), ) .whereArrayContainsAny( 'colors', FFAppState() .filterColorIds .map((e) => e.id) .toList()), ), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } int buttonCount = snapshot.data!; return FFButtonWidget( onPressed: () async { context.safePop(); }, text: 'Results (${buttonCount.toString()})', options: FFButtonOptions( height: 48.0, padding: EdgeInsetsDirectional.fromSTEB( 24.0, 0.0, 24.0, 0.0), iconPadding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 0.0, 0.0), color: FlutterFlowTheme.of(context).accent1, textStyle: FlutterFlowTheme.of(context) .titleSmall .override( fontFamily: 'SF Pro Display', color: Colors.white, useGoogleFonts: false, ), elevation: 3.0, borderSide: BorderSide( color: Colors.transparent, width: 1.0, ), borderRadius: BorderRadius.circular(8.0), ), ); }, ), ), ], ), ), ), ), ], ), ), ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/category
mirrored_repositories/flutterflow_ecommerce_app/lib/category/app_bar/app_bar_model.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'app_bar_widget.dart' show AppBarWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class AppBarModel extends FlutterFlowModel<AppBarWidget> { /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/category
mirrored_repositories/flutterflow_ecommerce_app/lib/category/app_bar/app_bar_widget.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'app_bar_model.dart'; export 'app_bar_model.dart'; class AppBarWidget extends StatefulWidget { const AppBarWidget({ Key? key, String? title, }) : this.title = title ?? 'N/A', super(key: key); final String title; @override _AppBarWidgetState createState() => _AppBarWidgetState(); } class _AppBarWidgetState extends State<AppBarWidget> { late AppBarModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => AppBarModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Container( width: double.infinity, height: 88.0, decoration: BoxDecoration(), child: Stack( children: [ Container( width: double.infinity, height: 66.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).primary, FlutterFlowTheme.of(context).secondary ], stops: [0.0, 1.0], begin: AlignmentDirectional(-1.0, 0.0), end: AlignmentDirectional(1.0, 0), ), ), ), Column( mainAxisSize: MainAxisSize.min, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { context.safePop(); }, child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/back.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ), Expanded( child: Align( alignment: AlignmentDirectional(0.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 24.0, 0.0), child: Text( widget.title, style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Display', color: FlutterFlowTheme.of(context) .secondaryBackground, fontSize: 19.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ), ), InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { context.pushNamed('filters'); }, child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/adjustments.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ), ], ), ), ], ), ], ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/profile
mirrored_repositories/flutterflow_ecommerce_app/lib/profile/profile/profile_widget.dart
import '/auth/firebase_auth/auth_util.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'profile_model.dart'; export 'profile_model.dart'; class ProfileWidget extends StatefulWidget { const ProfileWidget({Key? key}) : super(key: key); @override _ProfileWidgetState createState() => _ProfileWidgetState(); } class _ProfileWidgetState extends State<ProfileWidget> { late ProfileModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => ProfileModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Padding( padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 66.0), child: Column( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: double.infinity, height: 146.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).secondary, FlutterFlowTheme.of(context).primary ], stops: [0.0, 1.0], begin: AlignmentDirectional(1.0, 0.0), end: AlignmentDirectional(-1.0, 0), ), borderRadius: BorderRadius.only( bottomLeft: Radius.circular(0.0), bottomRight: Radius.circular(300.0), topLeft: Radius.circular(0.0), topRight: Radius.circular(0.0), ), ), alignment: AlignmentDirectional(0.0, 1.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 20.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 16.0, 0.0), child: Container( width: 70.0, height: 70.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, shape: BoxShape.circle, border: Border.all( color: FlutterFlowTheme.of(context).secondaryBackground, width: 1.0, ), ), child: Container( width: 70.0, height: 70.0, clipBehavior: Clip.antiAlias, decoration: BoxDecoration( shape: BoxShape.circle, ), child: SvgPicture.asset( 'assets/images/profile_icon_filled.svg', fit: BoxFit.scaleDown, ), ), ), ), Expanded( child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Customer', style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context).info, fontSize: 19.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 8.0, 0.0, 0.0), child: AuthUserStreamWidget( builder: (context) => Text( currentPhoneNumber, style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context).info, useGoogleFonts: false, ), ), ), ), ], ), ), ClipOval( child: Container( width: 48.0, height: 48.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, shape: BoxShape.circle, ), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/pen.svg', width: 300.0, height: 200.0, fit: BoxFit.scaleDown, ), ), ), ), ], ), ), ), Expanded( child: Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 24.0, 16.0, 0.0), child: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.max, children: [ Container( width: double.infinity, height: 56.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, borderRadius: BorderRadius.circular(8.0), ), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 12.0, 0.0), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/location.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ), Text( 'Shipping Addresses', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', fontSize: 17.0, fontWeight: FontWeight.w600, useGoogleFonts: false, ), ), ], ), ), ), Container( width: double.infinity, height: 56.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, borderRadius: BorderRadius.circular(8.0), ), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 12.0, 0.0), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/card.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ), Text( 'Payment Methods', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', fontSize: 17.0, fontWeight: FontWeight.w600, useGoogleFonts: false, ), ), ], ), ), ), Container( width: double.infinity, height: 56.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, borderRadius: BorderRadius.circular(8.0), ), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 12.0, 0.0), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/orders.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ), Text( 'Orders', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', fontSize: 17.0, fontWeight: FontWeight.w600, useGoogleFonts: false, ), ), ], ), ), ), Container( width: double.infinity, height: 56.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, borderRadius: BorderRadius.circular(8.0), ), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 12.0, 0.0), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/favorite_off.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ), Text( 'Favorite', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', fontSize: 17.0, fontWeight: FontWeight.w600, useGoogleFonts: false, ), ), ], ), ), ), Container( width: double.infinity, height: 56.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, borderRadius: BorderRadius.circular(8.0), ), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 12.0, 0.0), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/settings.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ), Text( 'Settings', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', fontSize: 17.0, fontWeight: FontWeight.w600, useGoogleFonts: false, ), ), ], ), ), ), InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { GoRouter.of(context).prepareAuthEvent(); await authManager.signOut(); GoRouter.of(context).clearRedirectLocation(); context.goNamedAuth('GetStarted', context.mounted); }, child: Container( width: double.infinity, height: 56.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, borderRadius: BorderRadius.circular(8.0), ), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 12.0, 0.0), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/exit.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ), Text( 'Log Out', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', fontSize: 17.0, fontWeight: FontWeight.w600, useGoogleFonts: false, ), ), ], ), ), ), ), ].divide(SizedBox(height: 16.0)), ), ), ), ), Align( alignment: AlignmentDirectional(-1.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 8.0, 0.0, 8.0), child: Text( 'Privacy Policy', style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context).secondaryText, fontSize: 12.0, decoration: TextDecoration.underline, useGoogleFonts: false, ), ), ), ), ], ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/profile
mirrored_repositories/flutterflow_ecommerce_app/lib/profile/profile/profile_model.dart
import '/auth/firebase_auth/auth_util.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'profile_widget.dart' show ProfileWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class ProfileModel extends FlutterFlowModel<ProfileWidget> { /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/internationalization.dart
import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:shared_preferences/shared_preferences.dart'; const _kLocaleStorageKey = '__locale_key__'; class FFLocalizations { FFLocalizations(this.locale); final Locale locale; static FFLocalizations of(BuildContext context) => Localizations.of<FFLocalizations>(context, FFLocalizations)!; static List<String> languages() => ['en']; static late SharedPreferences _prefs; static Future initialize() async => _prefs = await SharedPreferences.getInstance(); static Future storeLocale(String locale) => _prefs.setString(_kLocaleStorageKey, locale); static Locale? getStoredLocale() { final locale = _prefs.getString(_kLocaleStorageKey); return locale != null && locale.isNotEmpty ? createLocale(locale) : null; } String get languageCode => locale.toString(); String? get languageShortCode => _languagesWithShortCode.contains(locale.toString()) ? '${locale.toString()}_short' : null; int get languageIndex => languages().contains(languageCode) ? languages().indexOf(languageCode) : 0; String getText(String key) => (kTranslationsMap[key] ?? {})[locale.toString()] ?? ''; String getVariableText({ String? enText = '', }) => [enText][languageIndex] ?? ''; static const Set<String> _languagesWithShortCode = { 'ar', 'az', 'ca', 'cs', 'da', 'de', 'dv', 'en', 'es', 'et', 'fi', 'fr', 'gr', 'he', 'hi', 'hu', 'it', 'km', 'ku', 'mn', 'ms', 'no', 'pt', 'ro', 'ru', 'rw', 'sv', 'th', 'uk', 'vi', }; } class FFLocalizationsDelegate extends LocalizationsDelegate<FFLocalizations> { const FFLocalizationsDelegate(); @override bool isSupported(Locale locale) { final language = locale.toString(); return FFLocalizations.languages().contains( language.endsWith('_') ? language.substring(0, language.length - 1) : language, ); } @override Future<FFLocalizations> load(Locale locale) => SynchronousFuture<FFLocalizations>(FFLocalizations(locale)); @override bool shouldReload(FFLocalizationsDelegate old) => false; } Locale createLocale(String language) => language.contains('_') ? Locale.fromSubtags( languageCode: language.split('_').first, scriptCode: language.split('_').last, ) : Locale(language); final kTranslationsMap = <Map<String, Map<String, String>>>[].reduce((a, b) => a..addAll(b));
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/flutter_flow_animations.dart
import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; enum AnimationTrigger { onPageLoad, onActionTrigger, } class AnimationInfo { AnimationInfo({ required this.trigger, required this.effects, this.loop = false, this.reverse = false, this.applyInitialState = true, }); final AnimationTrigger trigger; final List<Effect<dynamic>> effects; final bool applyInitialState; final bool loop; final bool reverse; late AnimationController controller; } void createAnimation(AnimationInfo animation, TickerProvider vsync) { final newController = AnimationController(vsync: vsync); animation.controller = newController; } void setupAnimations(Iterable<AnimationInfo> animations, TickerProvider vsync) { animations.forEach((animation) => createAnimation(animation, vsync)); } extension AnimatedWidgetExtension on Widget { Widget animateOnPageLoad(AnimationInfo animationInfo) => Animate( effects: animationInfo.effects, child: this, onPlay: (controller) => animationInfo.loop ? controller.repeat(reverse: animationInfo.reverse) : null, onComplete: (controller) => !animationInfo.loop && animationInfo.reverse ? controller.reverse() : null); Widget animateOnActionTrigger( AnimationInfo animationInfo, { bool hasBeenTriggered = false, }) => hasBeenTriggered || animationInfo.applyInitialState ? Animate( controller: animationInfo.controller, autoPlay: false, effects: animationInfo.effects, child: this) : this; } class TiltEffect extends Effect<Offset> { const TiltEffect({ Duration? delay, Duration? duration, Curve? curve, Offset? begin, Offset? end, }) : super( delay: delay, duration: duration, curve: curve, begin: begin ?? const Offset(0.0, 0.0), end: end ?? const Offset(0.0, 0.0), ); @override Widget build( BuildContext context, Widget child, AnimationController controller, EffectEntry entry, ) { Animation<Offset> animation = buildAnimation(controller, entry); return getOptimizedBuilder<Offset>( animation: animation, builder: (_, __) => Transform( transform: Matrix4.identity() ..setEntry(3, 2, 0.001) ..rotateX(animation.value.dx) ..rotateY(animation.value.dy), alignment: Alignment.center, child: child, ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/uploaded_file.dart
import 'dart:convert'; import 'dart:typed_data' show Uint8List; class FFUploadedFile { const FFUploadedFile({ this.name, this.bytes, this.height, this.width, this.blurHash, }); final String? name; final Uint8List? bytes; final double? height; final double? width; final String? blurHash; @override String toString() => 'FFUploadedFile(name: $name, bytes: ${bytes?.length ?? 0}, height: $height, width: $width, blurHash: $blurHash,)'; String serialize() => jsonEncode( { 'name': name, 'bytes': bytes, 'height': height, 'width': width, 'blurHash': blurHash, }, ); static FFUploadedFile deserialize(String val) { final serializedData = jsonDecode(val) as Map<String, dynamic>; final data = { 'name': serializedData['name'] ?? '', 'bytes': serializedData['bytes'] ?? Uint8List.fromList([]), 'height': serializedData['height'], 'width': serializedData['width'], 'blurHash': serializedData['blurHash'], }; return FFUploadedFile( name: data['name'] as String, bytes: Uint8List.fromList(data['bytes'].cast<int>().toList()), height: data['height'] as double?, width: data['width'] as double?, blurHash: data['blurHash'] as String?, ); } @override int get hashCode => Object.hash( name, bytes, height, width, blurHash, ); @override bool operator ==(other) => other is FFUploadedFile && name == other.name && bytes == other.bytes && height == other.height && width == other.width && blurHash == other.blurHash; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/flutter_flow_icon_button.dart
import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class FlutterFlowIconButton extends StatefulWidget { const FlutterFlowIconButton({ Key? key, required this.icon, this.borderColor, this.borderRadius, this.borderWidth, this.buttonSize, this.fillColor, this.disabledColor, this.disabledIconColor, this.hoverColor, this.hoverIconColor, this.onPressed, this.showLoadingIndicator = false, }) : super(key: key); final Widget icon; final double? borderRadius; final double? buttonSize; final Color? fillColor; final Color? disabledColor; final Color? disabledIconColor; final Color? hoverColor; final Color? hoverIconColor; final Color? borderColor; final double? borderWidth; final bool showLoadingIndicator; final Function()? onPressed; @override State<FlutterFlowIconButton> createState() => _FlutterFlowIconButtonState(); } class _FlutterFlowIconButtonState extends State<FlutterFlowIconButton> { bool loading = false; late double? iconSize; late Color? iconColor; late Widget effectiveIcon; @override void initState() { super.initState(); _updateIcon(); } @override void didUpdateWidget(FlutterFlowIconButton oldWidget) { super.didUpdateWidget(oldWidget); _updateIcon(); } void _updateIcon() { final isFontAwesome = widget.icon is FaIcon; if (isFontAwesome) { FaIcon icon = widget.icon as FaIcon; effectiveIcon = FaIcon( icon.icon, size: icon.size, ); iconSize = icon.size; iconColor = icon.color; } else { Icon icon = widget.icon as Icon; effectiveIcon = Icon( icon.icon, size: icon.size, ); iconSize = icon.size; iconColor = icon.color; } } @override Widget build(BuildContext context) { ButtonStyle style = ButtonStyle( shape: MaterialStateProperty.resolveWith<OutlinedBorder>( (states) { return RoundedRectangleBorder( borderRadius: BorderRadius.circular(widget.borderRadius ?? 0), side: BorderSide( color: widget.borderColor ?? Colors.transparent, width: widget.borderWidth ?? 0, ), ); }, ), iconColor: MaterialStateProperty.resolveWith<Color?>( (states) { if (states.contains(MaterialState.disabled) && widget.disabledIconColor != null) { return widget.disabledIconColor; } if (states.contains(MaterialState.hovered) && widget.hoverIconColor != null) { return widget.hoverIconColor; } return iconColor; }, ), backgroundColor: MaterialStateProperty.resolveWith<Color?>( (states) { if (states.contains(MaterialState.disabled) && widget.disabledColor != null) { return widget.disabledColor; } if (states.contains(MaterialState.hovered) && widget.hoverColor != null) { return widget.hoverColor; } return widget.fillColor; }, ), overlayColor: MaterialStateProperty.resolveWith<Color?>((states) { if (states.contains(MaterialState.pressed)) { return null; } return widget.hoverColor == null ? null : Colors.transparent; }), ); return SizedBox( width: widget.buttonSize, height: widget.buttonSize, child: Theme( data: Theme.of(context).copyWith(useMaterial3: true), child: IgnorePointer( ignoring: (widget.showLoadingIndicator && loading), child: IconButton( icon: (widget.showLoadingIndicator && loading) ? Container( width: iconSize, height: iconSize, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( iconColor ?? Colors.white, ), ), ) : effectiveIcon, onPressed: widget.onPressed == null ? null : () async { if (loading) { return; } setState(() => loading = true); try { await widget.onPressed!(); } finally { if (mounted) { setState(() => loading = false); } } }, splashRadius: widget.buttonSize, style: style, ), ), ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/custom_functions.dart
import 'dart:convert'; import 'dart:math' as math; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; import 'package:timeago/timeago.dart' as timeago; import 'lat_lng.dart'; import 'place.dart'; import 'uploaded_file.dart'; import '/backend/backend.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import '/auth/firebase_auth/auth_util.dart'; String getDialCode(String countryFlag) { switch (countryFlag) { case '🇺🇦': return '+380'; case '🇺🇸': return '+1'; default: return '+380'; } } String clearFromPhoneMask(String phoneNumber) { return '+' + phoneNumber.replaceAll(RegExp(r'\D'), ''); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/flutter_flow_model.dart
import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:provider/provider.dart'; Widget wrapWithModel<T extends FlutterFlowModel>({ required T model, required Widget child, required VoidCallback updateCallback, bool updateOnChange = false, }) { // Set the component to optionally update the page on updates. model.setOnUpdate( onUpdate: updateCallback, updateOnChange: updateOnChange, ); // Models for components within a page will be disposed by the page's model, // so we don't want the component widget to dispose them until the page is // itself disposed. model.disposeOnWidgetDisposal = false; // Wrap in a Provider so that the model can be accessed by the component. return Provider<T>.value( value: model, child: child, ); } T createModel<T extends FlutterFlowModel>( BuildContext context, T Function() defaultBuilder, ) { final model = context.read<T?>() ?? defaultBuilder(); model._init(context); return model; } abstract class FlutterFlowModel<W extends Widget> { // Initialization methods bool _isInitialized = false; void initState(BuildContext context); void _init(BuildContext context) { if (!_isInitialized) { initState(context); _isInitialized = true; } if (context.widget is W) _widget = context.widget as W; } // The widget associated with this model. This is useful for accessing the // parameters of the widget, for example. W? _widget; // This will always be non-null when used, but is nullable to allow us to // dispose of the widget in the [dispose] method (for garbage collection). W get widget => _widget!; // Dispose methods // Whether to dispose this model when the corresponding widget is // disposed. By default this is true for pages and false for components, // as page/component models handle the disposal of their children. bool disposeOnWidgetDisposal = true; void dispose(); void maybeDispose() { if (disposeOnWidgetDisposal) { dispose(); } // Remove reference to widget for garbage collection purposes. _widget = null; } // Whether to update the containing page / component on updates. bool updateOnChange = false; // Function to call when the model receives an update. VoidCallback _updateCallback = () {}; void onUpdate() => updateOnChange ? _updateCallback() : () {}; FlutterFlowModel setOnUpdate({ bool updateOnChange = false, required VoidCallback onUpdate, }) => this .._updateCallback = onUpdate ..updateOnChange = updateOnChange; // Update the containing page when this model received an update. void updatePage(VoidCallback callback) { callback(); _updateCallback(); } } class FlutterFlowDynamicModels<T extends FlutterFlowModel> { FlutterFlowDynamicModels(this.defaultBuilder); final T Function() defaultBuilder; final Map<String, T> _childrenModels = {}; final Map<String, int> _childrenIndexes = {}; Set<String>? _activeKeys; T getModel(String uniqueKey, int index) { _updateActiveKeys(uniqueKey); _childrenIndexes[uniqueKey] = index; return _childrenModels[uniqueKey] ??= defaultBuilder(); } List<S> getValues<S>(S? Function(T) getValue) { return _childrenIndexes.entries // Sort keys by index. .sorted((a, b) => a.value.compareTo(b.value)) .where((e) => _childrenModels[e.key] != null) // Map each model to the desired value and return as list. In order // to preserve index order, rather than removing null values we provide // default values (for types with reasonable defaults). .map((e) => getValue(_childrenModels[e.key]!) ?? _getDefaultValue<S>()!) .toList(); } S? getValueAtIndex<S>(int index, S? Function(T) getValue) { final uniqueKey = _childrenIndexes.entries.firstWhereOrNull((e) => e.value == index)?.key; return getValueForKey(uniqueKey, getValue); } S? getValueForKey<S>(String? uniqueKey, S? Function(T) getValue) { final model = _childrenModels[uniqueKey]; return model != null ? getValue(model) : null; } void dispose() => _childrenModels.values.forEach((model) => model.dispose()); void _updateActiveKeys(String uniqueKey) { final shouldResetActiveKeys = _activeKeys == null; _activeKeys ??= {}; _activeKeys!.add(uniqueKey); if (shouldResetActiveKeys) { // Add a post-frame callback to remove and dispose of unused models after // we're done building, then reset `_activeKeys` to null so we know to do // this again next build. SchedulerBinding.instance.addPostFrameCallback((_) { _childrenIndexes.removeWhere((k, _) => !_activeKeys!.contains(k)); _childrenModels.keys .toSet() .difference(_activeKeys!) // Remove and dispose of unused models since they are not being used // elsewhere and would not otherwise be disposed. .forEach((k) => _childrenModels.remove(k)?.dispose()); _activeKeys = null; }); } } } T? _getDefaultValue<T>() { switch (T) { case int: return 0 as T; case double: return 0.0 as T; case String: return '' as T; case bool: return false as T; default: return null as T; } } extension TextValidationExtensions on String? Function(BuildContext, String?)? { String? Function(String?)? asValidator(BuildContext context) => this != null ? (val) => this!(context, val) : null; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/flutter_flow_widgets.dart
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:flutter/material.dart'; import 'package:auto_size_text/auto_size_text.dart'; class FFButtonOptions { const FFButtonOptions({ this.textStyle, this.elevation, this.height, this.width, this.padding, this.color, this.disabledColor, this.disabledTextColor, this.splashColor, this.iconSize, this.iconColor, this.iconPadding, this.borderRadius, this.borderSide, this.hoverColor, this.hoverBorderSide, this.hoverTextColor, this.hoverElevation, this.maxLines, }); final TextStyle? textStyle; final double? elevation; final double? height; final double? width; final EdgeInsetsGeometry? padding; final Color? color; final Color? disabledColor; final Color? disabledTextColor; final int? maxLines; final Color? splashColor; final double? iconSize; final Color? iconColor; final EdgeInsetsGeometry? iconPadding; final BorderRadius? borderRadius; final BorderSide? borderSide; final Color? hoverColor; final BorderSide? hoverBorderSide; final Color? hoverTextColor; final double? hoverElevation; } class FFButtonWidget extends StatefulWidget { const FFButtonWidget({ Key? key, required this.text, required this.onPressed, this.icon, this.iconData, required this.options, this.showLoadingIndicator = true, }) : super(key: key); final String text; final Widget? icon; final IconData? iconData; final Function()? onPressed; final FFButtonOptions options; final bool showLoadingIndicator; @override State<FFButtonWidget> createState() => _FFButtonWidgetState(); } class _FFButtonWidgetState extends State<FFButtonWidget> { bool loading = false; int get maxLines => widget.options.maxLines ?? 1; @override Widget build(BuildContext context) { Widget textWidget = loading ? SizedBox( width: widget.options.width == null ? _getTextWidth(widget.text, widget.options.textStyle, maxLines) : null, child: Center( child: SizedBox( width: 23, height: 23, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( widget.options.textStyle!.color ?? Colors.white, ), ), ), ), ) : AutoSizeText( widget.text, style: widget.options.textStyle?.withoutColor(), maxLines: maxLines, overflow: TextOverflow.ellipsis, ); final onPressed = widget.onPressed != null ? (widget.showLoadingIndicator ? () async { if (loading) { return; } setState(() => loading = true); try { await widget.onPressed!(); } finally { if (mounted) { setState(() => loading = false); } } } : () => widget.onPressed!()) : null; ButtonStyle style = ButtonStyle( shape: MaterialStateProperty.resolveWith<OutlinedBorder>( (states) { if (states.contains(MaterialState.hovered) && widget.options.hoverBorderSide != null) { return RoundedRectangleBorder( borderRadius: widget.options.borderRadius ?? BorderRadius.circular(8), side: widget.options.hoverBorderSide!, ); } return RoundedRectangleBorder( borderRadius: widget.options.borderRadius ?? BorderRadius.circular(8), side: widget.options.borderSide ?? BorderSide.none, ); }, ), foregroundColor: MaterialStateProperty.resolveWith<Color?>( (states) { if (states.contains(MaterialState.disabled) && widget.options.disabledTextColor != null) { return widget.options.disabledTextColor; } if (states.contains(MaterialState.hovered) && widget.options.hoverTextColor != null) { return widget.options.hoverTextColor; } return widget.options.textStyle?.color; }, ), backgroundColor: MaterialStateProperty.resolveWith<Color?>( (states) { if (states.contains(MaterialState.disabled) && widget.options.disabledColor != null) { return widget.options.disabledColor; } if (states.contains(MaterialState.hovered) && widget.options.hoverColor != null) { return widget.options.hoverColor; } return widget.options.color; }, ), overlayColor: MaterialStateProperty.resolveWith<Color?>((states) { if (states.contains(MaterialState.pressed)) { return widget.options.splashColor; } return widget.options.hoverColor == null ? null : Colors.transparent; }), padding: MaterialStateProperty.all(widget.options.padding ?? const EdgeInsets.symmetric(horizontal: 12.0, vertical: 4.0)), elevation: MaterialStateProperty.resolveWith<double?>( (states) { if (states.contains(MaterialState.hovered) && widget.options.hoverElevation != null) { return widget.options.hoverElevation!; } return widget.options.elevation; }, ), ); if ((widget.icon != null || widget.iconData != null) && !loading) { return Container( height: widget.options.height, width: widget.options.width, child: ElevatedButton.icon( icon: Padding( padding: widget.options.iconPadding ?? EdgeInsets.zero, child: widget.icon ?? FaIcon( widget.iconData, size: widget.options.iconSize, color: widget.options.iconColor ?? widget.options.textStyle!.color, ), ), label: textWidget, onPressed: onPressed, style: style, ), ); } return Container( height: widget.options.height, width: widget.options.width, child: ElevatedButton( onPressed: onPressed, style: style, child: textWidget, ), ); } } extension _WithoutColorExtension on TextStyle { TextStyle withoutColor() => TextStyle( inherit: inherit, color: null, backgroundColor: backgroundColor, fontSize: fontSize, fontWeight: fontWeight, fontStyle: fontStyle, letterSpacing: letterSpacing, wordSpacing: wordSpacing, textBaseline: textBaseline, height: height, leadingDistribution: leadingDistribution, locale: locale, foreground: foreground, background: background, shadows: shadows, fontFeatures: fontFeatures, decoration: decoration, decorationColor: decorationColor, decorationStyle: decorationStyle, decorationThickness: decorationThickness, debugLabel: debugLabel, fontFamily: fontFamily, fontFamilyFallback: fontFamilyFallback, // The _package field is private so unfortunately we can't set it here, // but it's almost always unset anyway. // package: _package, overflow: overflow, ); } // Slightly hacky method of getting the layout width of the provided text. double _getTextWidth(String text, TextStyle? style, int maxLines) => (TextPainter( text: TextSpan(text: text, style: style), textDirection: TextDirection.ltr, maxLines: maxLines, )..layout()) .size .width;
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/form_field_controller.dart
import 'package:flutter/foundation.dart'; class FormFieldController<T> extends ValueNotifier<T?> { FormFieldController(this.initialValue) : super(initialValue); final T? initialValue; void reset() => value = initialValue; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/lat_lng.dart
class LatLng { const LatLng(this.latitude, this.longitude); final double latitude; final double longitude; @override String toString() => 'LatLng(lat: $latitude, lng: $longitude)'; String serialize() => '$latitude,$longitude'; @override int get hashCode => latitude.hashCode + longitude.hashCode; @override bool operator ==(other) => other is LatLng && latitude == other.latitude && longitude == other.longitude; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/place.dart
import 'lat_lng.dart'; class FFPlace { const FFPlace({ this.latLng = const LatLng(0.0, 0.0), this.name = '', this.address = '', this.city = '', this.state = '', this.country = '', this.zipCode = '', }); final LatLng latLng; final String name; final String address; final String city; final String state; final String country; final String zipCode; @override String toString() => '''FFPlace( latLng: $latLng, name: $name, address: $address, city: $city, state: $state, country: $country, zipCode: $zipCode, )'''; @override int get hashCode => latLng.hashCode; @override bool operator ==(other) => other is FFPlace && latLng == other.latLng && name == other.name && address == other.address && city == other.city && state == other.state && country == other.country && zipCode == other.zipCode; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/random_data_util.dart
import 'dart:math'; import 'package:flutter/material.dart'; final _random = Random(); int randomInteger(int min, int max) { return _random.nextInt(max - min + 1) + min; } double randomDouble(double min, double max) { return _random.nextDouble() * (max - min) + min; } String randomString( int minLength, int maxLength, bool lowercaseAz, bool uppercaseAz, bool digits, ) { var chars = ''; if (lowercaseAz) { chars += 'abcdefghijklmnopqrstuvwxyz'; } if (uppercaseAz) { chars += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; } if (digits) { chars += '0123456789'; } return List.generate(randomInteger(minLength, maxLength), (index) => chars[_random.nextInt(chars.length)]).join(); } // Random date between 1970 and 2025. DateTime randomDate() { // Random max must be in range 0 < max <= 2^32. // So we have to generate the time in seconds and then convert to milliseconds. return DateTime.fromMillisecondsSinceEpoch( randomInteger(0, 1735689600) * 1000); } String randomImageUrl(int width, int height) { return 'https://picsum.photos/seed/${_random.nextInt(1000)}/$width/$height'; } Color randomColor() { return Color.fromARGB( 255, _random.nextInt(255), _random.nextInt(255), _random.nextInt(255)); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/instant_timer.dart
import 'dart:async'; extension TimerExt on Timer? { bool get isActive => this?.isActive ?? false; int get tick => this?.tick ?? 0; } class InstantTimer implements Timer { factory InstantTimer.periodic({ required Duration duration, required void Function(Timer timer) callback, bool startImmediately = true, }) { final myTimer = Timer.periodic(duration, callback); if (startImmediately) { Future.delayed(Duration(seconds: 0)).then((_) => callback(myTimer)); } return InstantTimer._(myTimer, startImmediately); } InstantTimer._(this._timer, this._startImmediately); final Timer _timer; final bool _startImmediately; @override void cancel() { _timer.cancel(); } @override bool get isActive => _timer.isActive; @override int get tick => _timer.tick + (_startImmediately ? 1 : 0); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/flutter_flow_theme.dart
// ignore_for_file: overridden_fields, annotate_overrides import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; abstract class FlutterFlowTheme { static FlutterFlowTheme of(BuildContext context) { return LightModeTheme(); } @Deprecated('Use primary instead') Color get primaryColor => primary; @Deprecated('Use secondary instead') Color get secondaryColor => secondary; @Deprecated('Use tertiary instead') Color get tertiaryColor => tertiary; late Color primary; late Color secondary; late Color tertiary; late Color alternate; late Color primaryText; late Color secondaryText; late Color primaryBackground; late Color secondaryBackground; late Color accent1; late Color accent2; late Color accent3; late Color accent4; late Color success; late Color warning; late Color error; late Color info; @Deprecated('Use displaySmallFamily instead') String get title1Family => displaySmallFamily; @Deprecated('Use displaySmall instead') TextStyle get title1 => typography.displaySmall; @Deprecated('Use headlineMediumFamily instead') String get title2Family => typography.headlineMediumFamily; @Deprecated('Use headlineMedium instead') TextStyle get title2 => typography.headlineMedium; @Deprecated('Use headlineSmallFamily instead') String get title3Family => typography.headlineSmallFamily; @Deprecated('Use headlineSmall instead') TextStyle get title3 => typography.headlineSmall; @Deprecated('Use titleMediumFamily instead') String get subtitle1Family => typography.titleMediumFamily; @Deprecated('Use titleMedium instead') TextStyle get subtitle1 => typography.titleMedium; @Deprecated('Use titleSmallFamily instead') String get subtitle2Family => typography.titleSmallFamily; @Deprecated('Use titleSmall instead') TextStyle get subtitle2 => typography.titleSmall; @Deprecated('Use bodyMediumFamily instead') String get bodyText1Family => typography.bodyMediumFamily; @Deprecated('Use bodyMedium instead') TextStyle get bodyText1 => typography.bodyMedium; @Deprecated('Use bodySmallFamily instead') String get bodyText2Family => typography.bodySmallFamily; @Deprecated('Use bodySmall instead') TextStyle get bodyText2 => typography.bodySmall; String get displayLargeFamily => typography.displayLargeFamily; TextStyle get displayLarge => typography.displayLarge; String get displayMediumFamily => typography.displayMediumFamily; TextStyle get displayMedium => typography.displayMedium; String get displaySmallFamily => typography.displaySmallFamily; TextStyle get displaySmall => typography.displaySmall; String get headlineLargeFamily => typography.headlineLargeFamily; TextStyle get headlineLarge => typography.headlineLarge; String get headlineMediumFamily => typography.headlineMediumFamily; TextStyle get headlineMedium => typography.headlineMedium; String get headlineSmallFamily => typography.headlineSmallFamily; TextStyle get headlineSmall => typography.headlineSmall; String get titleLargeFamily => typography.titleLargeFamily; TextStyle get titleLarge => typography.titleLarge; String get titleMediumFamily => typography.titleMediumFamily; TextStyle get titleMedium => typography.titleMedium; String get titleSmallFamily => typography.titleSmallFamily; TextStyle get titleSmall => typography.titleSmall; String get labelLargeFamily => typography.labelLargeFamily; TextStyle get labelLarge => typography.labelLarge; String get labelMediumFamily => typography.labelMediumFamily; TextStyle get labelMedium => typography.labelMedium; String get labelSmallFamily => typography.labelSmallFamily; TextStyle get labelSmall => typography.labelSmall; String get bodyLargeFamily => typography.bodyLargeFamily; TextStyle get bodyLarge => typography.bodyLarge; String get bodyMediumFamily => typography.bodyMediumFamily; TextStyle get bodyMedium => typography.bodyMedium; String get bodySmallFamily => typography.bodySmallFamily; TextStyle get bodySmall => typography.bodySmall; Typography get typography => ThemeTypography(this); } class LightModeTheme extends FlutterFlowTheme { @Deprecated('Use primary instead') Color get primaryColor => primary; @Deprecated('Use secondary instead') Color get secondaryColor => secondary; @Deprecated('Use tertiary instead') Color get tertiaryColor => tertiary; late Color primary = const Color(0xFF34283E); late Color secondary = const Color(0xFF845FA1); late Color tertiary = const Color(0xFF40304D); late Color alternate = const Color(0xFFE1E1E1); late Color primaryText = const Color(0xFF34283E); late Color secondaryText = const Color(0xFF605A65); late Color primaryBackground = const Color(0xFF9B9B9B); late Color secondaryBackground = const Color(0xFFFFFFFF); late Color accent1 = const Color(0xFFE7B944); late Color accent2 = const Color(0xFFF2994A); late Color accent3 = const Color(0xFFCE3E3E); late Color accent4 = const Color(0xCCFFFFFF); late Color success = const Color(0xFF249689); late Color warning = const Color(0xFFF9CF58); late Color error = const Color(0xFFFF5963); late Color info = const Color(0xFFFFFFFF); } abstract class Typography { String get displayLargeFamily; TextStyle get displayLarge; String get displayMediumFamily; TextStyle get displayMedium; String get displaySmallFamily; TextStyle get displaySmall; String get headlineLargeFamily; TextStyle get headlineLarge; String get headlineMediumFamily; TextStyle get headlineMedium; String get headlineSmallFamily; TextStyle get headlineSmall; String get titleLargeFamily; TextStyle get titleLarge; String get titleMediumFamily; TextStyle get titleMedium; String get titleSmallFamily; TextStyle get titleSmall; String get labelLargeFamily; TextStyle get labelLarge; String get labelMediumFamily; TextStyle get labelMedium; String get labelSmallFamily; TextStyle get labelSmall; String get bodyLargeFamily; TextStyle get bodyLarge; String get bodyMediumFamily; TextStyle get bodyMedium; String get bodySmallFamily; TextStyle get bodySmall; } class ThemeTypography extends Typography { ThemeTypography(this.theme); final FlutterFlowTheme theme; String get displayLargeFamily => 'SF Pro Text'; TextStyle get displayLarge => TextStyle( fontFamily: 'SF Pro Text', color: theme.primaryText, fontWeight: FontWeight.normal, fontSize: 64.0, ); String get displayMediumFamily => 'SF Pro Text'; TextStyle get displayMedium => TextStyle( fontFamily: 'SF Pro Text', color: theme.primaryText, fontWeight: FontWeight.normal, fontSize: 44.0, ); String get displaySmallFamily => 'SF Pro Text'; TextStyle get displaySmall => TextStyle( fontFamily: 'SF Pro Text', color: theme.primaryText, fontWeight: FontWeight.w600, fontSize: 36.0, ); String get headlineLargeFamily => 'SF Pro Text'; TextStyle get headlineLarge => TextStyle( fontFamily: 'SF Pro Text', color: theme.primaryText, fontWeight: FontWeight.w600, fontSize: 32.0, ); String get headlineMediumFamily => 'SF Pro Text'; TextStyle get headlineMedium => TextStyle( fontFamily: 'SF Pro Text', color: theme.primaryText, fontWeight: FontWeight.normal, fontSize: 24.0, ); String get headlineSmallFamily => 'SF Pro Text'; TextStyle get headlineSmall => TextStyle( fontFamily: 'SF Pro Text', color: theme.primaryText, fontWeight: FontWeight.w500, fontSize: 24.0, ); String get titleLargeFamily => 'SF Pro Text'; TextStyle get titleLarge => TextStyle( fontFamily: 'SF Pro Text', color: theme.primaryText, fontWeight: FontWeight.w500, fontSize: 22.0, ); String get titleMediumFamily => 'SF Pro Display'; TextStyle get titleMedium => TextStyle( fontFamily: 'SF Pro Display', color: theme.info, fontWeight: FontWeight.normal, fontSize: 18.0, ); String get titleSmallFamily => 'SF Pro Display'; TextStyle get titleSmall => TextStyle( fontFamily: 'SF Pro Display', color: theme.info, fontWeight: FontWeight.w500, fontSize: 16.0, ); String get labelLargeFamily => 'SF Pro Display'; TextStyle get labelLarge => TextStyle( fontFamily: 'SF Pro Display', color: theme.secondaryText, fontWeight: FontWeight.normal, fontSize: 16.0, ); String get labelMediumFamily => 'SF Pro Display'; TextStyle get labelMedium => TextStyle( fontFamily: 'SF Pro Display', color: theme.secondaryText, fontWeight: FontWeight.normal, fontSize: 14.0, ); String get labelSmallFamily => 'SF Pro Display'; TextStyle get labelSmall => TextStyle( fontFamily: 'SF Pro Display', color: theme.secondaryText, fontWeight: FontWeight.normal, fontSize: 12.0, ); String get bodyLargeFamily => 'SF Pro Display'; TextStyle get bodyLarge => TextStyle( fontFamily: 'SF Pro Display', color: theme.primaryText, fontWeight: FontWeight.normal, fontSize: 16.0, ); String get bodyMediumFamily => 'SF Pro Display'; TextStyle get bodyMedium => TextStyle( fontFamily: 'SF Pro Display', color: theme.primaryText, fontWeight: FontWeight.normal, fontSize: 14.0, ); String get bodySmallFamily => 'SF Pro Display'; TextStyle get bodySmall => TextStyle( fontFamily: 'SF Pro Display', color: theme.primaryText, fontWeight: FontWeight.normal, fontSize: 12.0, ); } extension TextStyleHelper on TextStyle { TextStyle override({ String? fontFamily, Color? color, double? fontSize, FontWeight? fontWeight, double? letterSpacing, FontStyle? fontStyle, bool useGoogleFonts = true, TextDecoration? decoration, double? lineHeight, }) => useGoogleFonts ? GoogleFonts.getFont( fontFamily!, color: color ?? this.color, fontSize: fontSize ?? this.fontSize, letterSpacing: letterSpacing ?? this.letterSpacing, fontWeight: fontWeight ?? this.fontWeight, fontStyle: fontStyle ?? this.fontStyle, decoration: decoration, height: lineHeight, ) : copyWith( fontFamily: fontFamily, color: color, fontSize: fontSize, letterSpacing: letterSpacing, fontWeight: fontWeight, fontStyle: fontStyle, decoration: decoration, height: lineHeight, ); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/flutter_flow_drop_down.dart
import 'package:dropdown_button2/dropdown_button2.dart'; import 'form_field_controller.dart'; import 'package:flutter/material.dart'; class FlutterFlowDropDown<T> extends StatefulWidget { const FlutterFlowDropDown({ Key? key, required this.controller, this.hintText, this.searchHintText, required this.options, this.optionLabels, this.onChanged, this.onChangedForMultiSelect, this.icon, this.width, this.height, this.maxHeight, this.fillColor, this.searchHintTextStyle, this.searchCursorColor, required this.textStyle, required this.elevation, required this.borderWidth, required this.borderRadius, required this.borderColor, required this.margin, this.hidesUnderline = false, this.disabled = false, this.isOverButton = false, this.isSearchable = false, this.isMultiSelect = false, }) : super(key: key); final FormFieldController<T> controller; final String? hintText; final String? searchHintText; final List<T> options; final List<String>? optionLabels; final Function(T?)? onChanged; final Function(List<T>?)? onChangedForMultiSelect; final Widget? icon; final double? width; final double? height; final double? maxHeight; final Color? fillColor; final TextStyle? searchHintTextStyle; final Color? searchCursorColor; final TextStyle textStyle; final double elevation; final double borderWidth; final double borderRadius; final Color borderColor; final EdgeInsetsGeometry margin; final bool hidesUnderline; final bool disabled; final bool isOverButton; final bool isSearchable; final bool isMultiSelect; @override State<FlutterFlowDropDown<T>> createState() => _FlutterFlowDropDownState<T>(); } class _FlutterFlowDropDownState<T> extends State<FlutterFlowDropDown<T>> { final TextEditingController _textEditingController = TextEditingController(); void Function() get listener => widget.isMultiSelect ? () {} : () => widget.onChanged!(widget.controller.value); @override void initState() { widget.controller.addListener(listener); super.initState(); } @override void dispose() { widget.controller.removeListener(listener); super.dispose(); } List<T> selectedItems = []; @override Widget build(BuildContext context) { final optionToDisplayValue = Map.fromEntries( widget.options.asMap().entries.map((option) => MapEntry( option.value, widget.optionLabels == null || widget.optionLabels!.length < option.key + 1 ? option.value.toString() : widget.optionLabels![option.key])), ); final value = widget.options.contains(widget.controller.value) ? widget.controller.value : null; final items = widget.options .map( (option) => DropdownMenuItem<T>( value: option, child: Text( optionToDisplayValue[option] ?? '', style: widget.textStyle, ), ), ) .toList(); final hintText = widget.hintText != null ? Text(widget.hintText!, style: widget.textStyle) : null; void Function(T?)? onChanged = widget.disabled || widget.isMultiSelect ? null : (value) => widget.controller.value = value; final dropdownWidget = _useDropdown2() ? _buildDropdown( value, items, onChanged, hintText, optionToDisplayValue, widget.isSearchable, widget.disabled, widget.isMultiSelect, widget.onChangedForMultiSelect, ) : _buildLegacyDropdown(value, items, onChanged, hintText); final childWidget = DecoratedBox( decoration: BoxDecoration( borderRadius: BorderRadius.circular(widget.borderRadius), border: Border.all( color: widget.borderColor, width: widget.borderWidth, ), color: widget.fillColor, ), child: Padding( padding: widget.margin, child: widget.hidesUnderline ? DropdownButtonHideUnderline(child: dropdownWidget) : dropdownWidget, ), ); if (widget.height != null || widget.width != null) { return Container( width: widget.width, height: widget.height, child: childWidget, ); } return childWidget; } Widget _buildLegacyDropdown( T? value, List<DropdownMenuItem<T>>? items, void Function(T?)? onChanged, Text? hintText, ) { return DropdownButton<T>( value: value, hint: hintText, items: items, elevation: widget.elevation.toInt(), onChanged: onChanged, icon: widget.icon, isExpanded: true, dropdownColor: widget.fillColor, focusColor: Colors.transparent, ); } Widget _buildDropdown( T? value, List<DropdownMenuItem<T>>? items, void Function(T?)? onChanged, Text? hintText, Map<T, String> optionLabels, bool isSearchable, bool disabled, bool isMultiSelect, Function(List<T>?)? onChangedForMultiSelect, ) { final overlayColor = MaterialStateProperty.resolveWith<Color?>((states) => states.contains(MaterialState.focused) ? Colors.transparent : null); final iconStyleData = widget.icon != null ? IconStyleData(icon: widget.icon!) : const IconStyleData(); return DropdownButton2<T>( value: isMultiSelect ? selectedItems.isEmpty ? null : selectedItems.last : value, hint: hintText, items: isMultiSelect ? widget.options.map((item) { return DropdownMenuItem( value: item, // Disable default onTap to avoid closing menu when selecting an item enabled: false, child: StatefulBuilder( builder: (context, menuSetState) { final isSelected = selectedItems.contains(item); return InkWell( onTap: () { isSelected ? selectedItems.remove(item) : selectedItems.add(item); onChangedForMultiSelect!(selectedItems); //This rebuilds the StatefulWidget to update the button's text setState(() {}); //This rebuilds the dropdownMenu Widget to update the check mark menuSetState(() {}); }, child: Container( height: double.infinity, padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Row( children: [ if (isSelected) const Icon(Icons.check_box_outlined) else const Icon(Icons.check_box_outline_blank), const SizedBox(width: 16), Expanded( child: Text( item as String, style: widget.textStyle, ), ), ], ), ), ); }, ), ); }).toList() : items, iconStyleData: iconStyleData, buttonStyleData: ButtonStyleData( elevation: widget.elevation.toInt(), overlayColor: overlayColor, ), menuItemStyleData: MenuItemStyleData(overlayColor: overlayColor), dropdownStyleData: DropdownStyleData( elevation: widget.elevation!.toInt(), decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: widget.fillColor, ), isOverButton: widget.isOverButton, maxHeight: widget.maxHeight, ), // onChanged is handled by the onChangedForMultiSelect function onChanged: isMultiSelect ? disabled ? null : (val) {} : onChanged, isExpanded: true, selectedItemBuilder: isMultiSelect ? (context) { return widget.options.map( (item) { return Container( alignment: AlignmentDirectional.center, child: Text( selectedItems.join(', '), style: const TextStyle( fontSize: 14, overflow: TextOverflow.ellipsis, ), maxLines: 1, ), ); }, ).toList(); } : null, dropdownSearchData: isSearchable ? DropdownSearchData<T>( searchController: _textEditingController, searchInnerWidgetHeight: 50, searchInnerWidget: Container( height: 50, padding: const EdgeInsets.only( top: 8, bottom: 4, right: 8, left: 8, ), child: TextFormField( expands: true, maxLines: null, controller: _textEditingController, cursorColor: widget.searchCursorColor, decoration: InputDecoration( isDense: true, contentPadding: const EdgeInsets.symmetric( horizontal: 10, vertical: 8, ), hintText: widget.searchHintText, hintStyle: widget.searchHintTextStyle, border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), ), ), ), ), searchMatchFn: (item, searchValue) { return (optionLabels[item.value] ?? '') .toLowerCase() .contains(searchValue.toLowerCase()); }, ) : null, // This to clear the search value when you close the menu onMenuStateChange: isSearchable ? (isOpen) { if (!isOpen) { _textEditingController.clear(); } } : null, ); } bool _useDropdown2() { return widget.isMultiSelect || widget.isSearchable || !widget.isOverButton || widget.maxHeight != null; } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/flutter_flow_util.dart
import 'dart:io'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/material.dart'; import 'package:from_css_color/from_css_color.dart'; import 'package:intl/intl.dart'; import 'package:json_path/json_path.dart'; import 'package:timeago/timeago.dart' as timeago; import 'package:url_launcher/url_launcher.dart'; import '../main.dart'; import 'lat_lng.dart'; export 'lat_lng.dart'; export 'place.dart'; export 'uploaded_file.dart'; export '../app_state.dart'; export 'flutter_flow_model.dart'; export 'dart:math' show min, max; export 'dart:typed_data' show Uint8List; export 'dart:convert' show jsonEncode, jsonDecode; export 'package:intl/intl.dart'; export 'package:cloud_firestore/cloud_firestore.dart' show DocumentReference, FirebaseFirestore; export 'package:page_transition/page_transition.dart'; export 'nav/nav.dart'; T valueOrDefault<T>(T? value, T defaultValue) => (value is String && value.isEmpty) || value == null ? defaultValue : value; String dateTimeFormat(String format, DateTime? dateTime, {String? locale}) { if (dateTime == null) { return ''; } if (format == 'relative') { return timeago.format(dateTime, locale: locale, allowFromNow: true); } return DateFormat(format, locale).format(dateTime); } Future launchURL(String url) async { var uri = Uri.parse(url).toString(); try { await launch(uri); } catch (e) { throw 'Could not launch $uri: $e'; } } Color colorFromCssString(String color, {Color? defaultColor}) { try { return fromCssColor(color); } catch (_) {} return defaultColor ?? Colors.black; } enum FormatType { decimal, percent, scientific, compact, compactLong, custom, } enum DecimalType { automatic, periodDecimal, commaDecimal, } String formatNumber( num? value, { required FormatType formatType, DecimalType? decimalType, String? currency, bool toLowerCase = false, String? format, String? locale, }) { if (value == null) { return ''; } var formattedValue = ''; switch (formatType) { case FormatType.decimal: switch (decimalType!) { case DecimalType.automatic: formattedValue = NumberFormat.decimalPattern().format(value); break; case DecimalType.periodDecimal: formattedValue = NumberFormat.decimalPattern('en_US').format(value); break; case DecimalType.commaDecimal: formattedValue = NumberFormat.decimalPattern('es_PA').format(value); break; } break; case FormatType.percent: formattedValue = NumberFormat.percentPattern().format(value); break; case FormatType.scientific: formattedValue = NumberFormat.scientificPattern().format(value); if (toLowerCase) { formattedValue = formattedValue.toLowerCase(); } break; case FormatType.compact: formattedValue = NumberFormat.compact().format(value); break; case FormatType.compactLong: formattedValue = NumberFormat.compactLong().format(value); break; case FormatType.custom: final hasLocale = locale != null && locale.isNotEmpty; formattedValue = NumberFormat(format, hasLocale ? locale : null).format(value); } if (formattedValue.isEmpty) { return value.toString(); } if (currency != null) { final currencySymbol = currency.isNotEmpty ? currency : NumberFormat.simpleCurrency().format(0.0).substring(0, 1); formattedValue = '$currencySymbol$formattedValue'; } return formattedValue; } DateTime get getCurrentTimestamp => DateTime.now(); DateTime dateTimeFromSecondsSinceEpoch(int seconds) { return DateTime.fromMillisecondsSinceEpoch(seconds * 1000); } extension DateTimeConversionExtension on DateTime { int get secondsSinceEpoch => (millisecondsSinceEpoch / 1000).round(); } extension DateTimeComparisonOperators on DateTime { bool operator <(DateTime other) => isBefore(other); bool operator >(DateTime other) => isAfter(other); bool operator <=(DateTime other) => this < other || isAtSameMomentAs(other); bool operator >=(DateTime other) => this > other || isAtSameMomentAs(other); } T? castToType<T>(dynamic value) { if (value == null) { return null; } switch (T) { case double: // Doubles may be stored as ints in some cases. return value.toDouble() as T; case int: // Likewise, ints may be stored as doubles. If this is the case // (i.e. no decimal value), return the value as an int. if (value is num && value.toInt() == value) { return value.toInt() as T; } break; default: break; } return value as T; } dynamic getJsonField( dynamic response, String jsonPath, [ bool isForList = false, ]) { final field = JsonPath(jsonPath).read(response); if (field.isEmpty) { return null; } if (field.length > 1) { return field.map((f) => f.value).toList(); } final value = field.first.value; if (isForList) { return value is! Iterable ? [value] : (value is List ? value : value.toList()); } return value; } Rect? getWidgetBoundingBox(BuildContext context) { try { final renderBox = context.findRenderObject() as RenderBox?; return renderBox!.localToGlobal(Offset.zero) & renderBox.size; } catch (_) { return null; } } bool get isAndroid => !kIsWeb && Platform.isAndroid; bool get isiOS => !kIsWeb && Platform.isIOS; bool get isWeb => kIsWeb; const kBreakpointSmall = 479.0; const kBreakpointMedium = 767.0; const kBreakpointLarge = 991.0; bool isMobileWidth(BuildContext context) => MediaQuery.sizeOf(context).width < kBreakpointSmall; bool responsiveVisibility({ required BuildContext context, bool phone = true, bool tablet = true, bool tabletLandscape = true, bool desktop = true, }) { final width = MediaQuery.sizeOf(context).width; if (width < kBreakpointSmall) { return phone; } else if (width < kBreakpointMedium) { return tablet; } else if (width < kBreakpointLarge) { return tabletLandscape; } else { return desktop; } } const kTextValidatorUsernameRegex = r'^[a-zA-Z][a-zA-Z0-9_-]{2,16}$'; // https://stackoverflow.com/a/201378 const kTextValidatorEmailRegex = "^(?:[a-z0-9!#\$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#\$%&\'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])\$"; const kTextValidatorWebsiteRegex = r'(https?:\/\/)?(www\.)[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,10}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)|(https?:\/\/)?(www\.)?(?!ww)[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,10}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)'; extension FFTextEditingControllerExt on TextEditingController? { String get text => this == null ? '' : this!.text; set text(String newText) => this?.text = newText; } extension IterableExt<T> on Iterable<T> { List<T> sortedList<S extends Comparable>([S Function(T)? keyOf]) => toList() ..sort(keyOf == null ? null : ((a, b) => keyOf(a).compareTo(keyOf(b)))); List<S> mapIndexed<S>(S Function(int, T) func) => toList() .asMap() .map((index, value) => MapEntry(index, func(index, value))) .values .toList(); } extension StringDocRef on String { DocumentReference get ref => FirebaseFirestore.instance.doc(this); } void setAppLanguage(BuildContext context, String language) => MyApp.of(context).setLocale(language); void setDarkModeSetting(BuildContext context, ThemeMode themeMode) => MyApp.of(context).setThemeMode(themeMode); void showSnackbar( BuildContext context, String message, { bool loading = false, int duration = 4, }) { ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Row( children: [ if (loading) Padding( padding: EdgeInsetsDirectional.only(end: 10.0), child: Container( height: 20, width: 20, child: const CircularProgressIndicator( color: Colors.white, ), ), ), Text(message), ], ), duration: Duration(seconds: duration), ), ); } extension FFStringExt on String { String maybeHandleOverflow({int? maxChars, String replacement = ''}) => maxChars != null && length > maxChars ? replaceRange(maxChars, null, replacement) : this; } extension ListFilterExt<T> on Iterable<T?> { List<T> get withoutNulls => where((s) => s != null).map((e) => e!).toList(); } extension ListDivideExt<T extends Widget> on Iterable<T> { Iterable<MapEntry<int, Widget>> get enumerate => toList().asMap().entries; List<Widget> divide(Widget t) => isEmpty ? [] : (enumerate.map((e) => [e.value, t]).expand((i) => i).toList() ..removeLast()); List<Widget> around(Widget t) => addToStart(t).addToEnd(t); List<Widget> addToStart(Widget t) => enumerate.map((e) => e.value).toList()..insert(0, t); List<Widget> addToEnd(Widget t) => enumerate.map((e) => e.value).toList()..add(t); List<Padding> paddingTopEach(double val) => map((w) => Padding(padding: EdgeInsets.only(top: val), child: w)) .toList(); } extension StatefulWidgetExtensions on State<StatefulWidget> { /// Check if the widget exist before safely setting state. void safeSetState(VoidCallback fn) { if (mounted) { // ignore: invalid_use_of_protected_member setState(fn); } } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/nav/serialization_util.dart
import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:from_css_color/from_css_color.dart'; import '/backend/backend.dart'; import '../../flutter_flow/lat_lng.dart'; import '../../flutter_flow/place.dart'; import '../../flutter_flow/uploaded_file.dart'; /// SERIALIZATION HELPERS String dateTimeRangeToString(DateTimeRange dateTimeRange) { final startStr = dateTimeRange.start.millisecondsSinceEpoch.toString(); final endStr = dateTimeRange.end.millisecondsSinceEpoch.toString(); return '$startStr|$endStr'; } String placeToString(FFPlace place) => jsonEncode({ 'latLng': place.latLng.serialize(), 'name': place.name, 'address': place.address, 'city': place.city, 'state': place.state, 'country': place.country, 'zipCode': place.zipCode, }); String uploadedFileToString(FFUploadedFile uploadedFile) => uploadedFile.serialize(); const _kDocIdDelimeter = '|'; String _serializeDocumentReference(DocumentReference ref) { final docIds = <String>[]; DocumentReference? currentRef = ref; while (currentRef != null) { docIds.add(currentRef.id); // Get the parent document (catching any errors that arise). currentRef = safeGet<DocumentReference?>(() => currentRef?.parent.parent); } // Reverse the list to get the correct ordering. return docIds.reversed.join(_kDocIdDelimeter); } String? serializeParam( dynamic param, ParamType paramType, [ bool isList = false, ]) { try { if (param == null) { return null; } if (isList) { final serializedValues = (param as Iterable) .map((p) => serializeParam(p, paramType, false)) .where((p) => p != null) .map((p) => p!) .toList(); return json.encode(serializedValues); } switch (paramType) { case ParamType.int: return param.toString(); case ParamType.double: return param.toString(); case ParamType.String: return param; case ParamType.bool: return param ? 'true' : 'false'; case ParamType.DateTime: return (param as DateTime).millisecondsSinceEpoch.toString(); case ParamType.DateTimeRange: return dateTimeRangeToString(param as DateTimeRange); case ParamType.LatLng: return (param as LatLng).serialize(); case ParamType.Color: return (param as Color).toCssString(); case ParamType.FFPlace: return placeToString(param as FFPlace); case ParamType.FFUploadedFile: return uploadedFileToString(param as FFUploadedFile); case ParamType.JSON: return json.encode(param); case ParamType.DocumentReference: return _serializeDocumentReference(param as DocumentReference); case ParamType.Document: final reference = (param as FirestoreRecord).reference; return _serializeDocumentReference(reference); default: return null; } } catch (e) { print('Error serializing parameter: $e'); return null; } } /// END SERIALIZATION HELPERS /// DESERIALIZATION HELPERS DateTimeRange? dateTimeRangeFromString(String dateTimeRangeStr) { final pieces = dateTimeRangeStr.split('|'); if (pieces.length != 2) { return null; } return DateTimeRange( start: DateTime.fromMillisecondsSinceEpoch(int.parse(pieces.first)), end: DateTime.fromMillisecondsSinceEpoch(int.parse(pieces.last)), ); } LatLng? latLngFromString(String latLngStr) { final pieces = latLngStr.split(','); if (pieces.length != 2) { return null; } return LatLng( double.parse(pieces.first.trim()), double.parse(pieces.last.trim()), ); } FFPlace placeFromString(String placeStr) { final serializedData = jsonDecode(placeStr) as Map<String, dynamic>; final data = { 'latLng': serializedData.containsKey('latLng') ? latLngFromString(serializedData['latLng'] as String) : const LatLng(0.0, 0.0), 'name': serializedData['name'] ?? '', 'address': serializedData['address'] ?? '', 'city': serializedData['city'] ?? '', 'state': serializedData['state'] ?? '', 'country': serializedData['country'] ?? '', 'zipCode': serializedData['zipCode'] ?? '', }; return FFPlace( latLng: data['latLng'] as LatLng, name: data['name'] as String, address: data['address'] as String, city: data['city'] as String, state: data['state'] as String, country: data['country'] as String, zipCode: data['zipCode'] as String, ); } FFUploadedFile uploadedFileFromString(String uploadedFileStr) => FFUploadedFile.deserialize(uploadedFileStr); DocumentReference _deserializeDocumentReference( String refStr, List<String> collectionNamePath, ) { var path = ''; final docIds = refStr.split(_kDocIdDelimeter); for (int i = 0; i < docIds.length && i < collectionNamePath.length; i++) { path += '/${collectionNamePath[i]}/${docIds[i]}'; } return FirebaseFirestore.instance.doc(path); } enum ParamType { int, double, String, bool, DateTime, DateTimeRange, LatLng, Color, FFPlace, FFUploadedFile, JSON, Document, DocumentReference, } dynamic deserializeParam<T>( String? param, ParamType paramType, bool isList, { List<String>? collectionNamePath, }) { try { if (param == null) { return null; } if (isList) { final paramValues = json.decode(param); if (paramValues is! Iterable || paramValues.isEmpty) { return null; } return paramValues .where((p) => p is String) .map((p) => p as String) .map((p) => deserializeParam<T>(p, paramType, false, collectionNamePath: collectionNamePath)) .where((p) => p != null) .map((p) => p! as T) .toList(); } switch (paramType) { case ParamType.int: return int.tryParse(param); case ParamType.double: return double.tryParse(param); case ParamType.String: return param; case ParamType.bool: return param == 'true'; case ParamType.DateTime: final milliseconds = int.tryParse(param); return milliseconds != null ? DateTime.fromMillisecondsSinceEpoch(milliseconds) : null; case ParamType.DateTimeRange: return dateTimeRangeFromString(param); case ParamType.LatLng: return latLngFromString(param); case ParamType.Color: return fromCssColor(param); case ParamType.FFPlace: return placeFromString(param); case ParamType.FFUploadedFile: return uploadedFileFromString(param); case ParamType.JSON: return json.decode(param); case ParamType.DocumentReference: return _deserializeDocumentReference(param, collectionNamePath ?? []); default: return null; } } catch (e) { print('Error deserializing parameter: $e'); return null; } } Future<dynamic> Function(String) getDoc( List<String> collectionNamePath, RecordBuilder recordBuilder, ) { return (String ids) => _deserializeDocumentReference(ids, collectionNamePath) .get() .then((s) => recordBuilder(s)); } Future<List<T>> Function(String) getDocList<T>( List<String> collectionNamePath, RecordBuilder<T> recordBuilder, ) { return (String idsList) { List<String> docIds = []; try { final ids = json.decode(idsList) as Iterable; docIds = ids.where((d) => d is String).map((d) => d as String).toList(); } catch (_) {} return Future.wait( docIds.map( (ids) => _deserializeDocumentReference(ids, collectionNamePath) .get() .then((s) => recordBuilder(s)), ), ).then((docs) => docs.where((d) => d != null).map((d) => d!).toList()); }; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow
mirrored_repositories/flutterflow_ecommerce_app/lib/flutter_flow/nav/nav.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:page_transition/page_transition.dart'; import 'package:provider/provider.dart'; import '/backend/backend.dart'; import '/auth/base_auth_user_provider.dart'; import '/index.dart'; import '/main.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/lat_lng.dart'; import '/flutter_flow/place.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'serialization_util.dart'; export 'package:go_router/go_router.dart'; export 'serialization_util.dart'; const kTransitionInfoKey = '__transition_info__'; class AppStateNotifier extends ChangeNotifier { AppStateNotifier._(); static AppStateNotifier? _instance; static AppStateNotifier get instance => _instance ??= AppStateNotifier._(); BaseAuthUser? initialUser; BaseAuthUser? user; bool showSplashImage = true; String? _redirectLocation; /// Determines whether the app will refresh and build again when a sign /// in or sign out happens. This is useful when the app is launched or /// on an unexpected logout. However, this must be turned off when we /// intend to sign in/out and then navigate or perform any actions after. /// Otherwise, this will trigger a refresh and interrupt the action(s). bool notifyOnAuthChange = true; bool get loading => user == null || showSplashImage; bool get loggedIn => user?.loggedIn ?? false; bool get initiallyLoggedIn => initialUser?.loggedIn ?? false; bool get shouldRedirect => loggedIn && _redirectLocation != null; String getRedirectLocation() => _redirectLocation!; bool hasRedirect() => _redirectLocation != null; void setRedirectLocationIfUnset(String loc) => _redirectLocation ??= loc; void clearRedirectLocation() => _redirectLocation = null; /// Mark as not needing to notify on a sign in / out when we intend /// to perform subsequent actions (such as navigation) afterwards. void updateNotifyOnAuthChange(bool notify) => notifyOnAuthChange = notify; void update(BaseAuthUser newUser) { final shouldUpdate = user?.uid == null || newUser.uid == null || user?.uid != newUser.uid; initialUser ??= newUser; user = newUser; // Refresh the app on auth change unless explicitly marked otherwise. // No need to update unless the user has changed. if (notifyOnAuthChange && shouldUpdate) { notifyListeners(); } // Once again mark the notifier as needing to update on auth change // (in order to catch sign in / out events). updateNotifyOnAuthChange(true); } void stopShowingSplashImage() { showSplashImage = false; notifyListeners(); } } GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter( initialLocation: '/', debugLogDiagnostics: true, refreshListenable: appStateNotifier, errorBuilder: (context, state) => appStateNotifier.loggedIn ? NavigationWidget() : GetStartedWidget(), routes: [ FFRoute( name: '_initialize', path: '/', builder: (context, _) => appStateNotifier.loggedIn ? NavigationWidget() : GetStartedWidget(), ), FFRoute( name: 'GetStarted', path: '/getStarted', builder: (context, params) => GetStartedWidget(), ), FFRoute( name: 'Navigation', path: '/navigation', builder: (context, params) => NavigationWidget(), ), FFRoute( name: 'EnterPhone', path: '/enterPhone', builder: (context, params) => EnterPhoneWidget(), ), FFRoute( name: 'OTPCode', path: '/oTPCode', builder: (context, params) => OTPCodeWidget(), ), FFRoute( name: 'CategoryPage', path: '/categoryPage', asyncParams: { 'category': getDoc(['categories'], CategoriesRecord.fromSnapshot), }, builder: (context, params) => CategoryPageWidget( title: params.getParam('title', ParamType.String), category: params.getParam('category', ParamType.Document), ), ), FFRoute( name: 'filters', path: '/filters', builder: (context, params) => FiltersWidget(), ), FFRoute( name: 'PorductPage', path: '/porductPage', asyncParams: { 'product': getDoc(['products'], ProductsRecord.fromSnapshot), }, builder: (context, params) => PorductPageWidget( product: params.getParam('product', ParamType.Document), ), ), FFRoute( name: 'CartPage', path: '/cartPage', builder: (context, params) => CartPageWidget(), ), FFRoute( name: 'CheckOutPage', path: '/checkOutPage', builder: (context, params) => CheckOutPageWidget(), ) ].map((r) => r.toRoute(appStateNotifier)).toList(), ); extension NavParamExtensions on Map<String, String?> { Map<String, String> get withoutNulls => Map.fromEntries( entries .where((e) => e.value != null) .map((e) => MapEntry(e.key, e.value!)), ); } extension NavigationExtensions on BuildContext { void goNamedAuth( String name, bool mounted, { Map<String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, Object? extra, bool ignoreRedirect = false, }) => !mounted || GoRouter.of(this).shouldRedirect(ignoreRedirect) ? null : goNamed( name, pathParameters: pathParameters, queryParameters: queryParameters, extra: extra, ); void pushNamedAuth( String name, bool mounted, { Map<String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, Object? extra, bool ignoreRedirect = false, }) => !mounted || GoRouter.of(this).shouldRedirect(ignoreRedirect) ? null : pushNamed( name, pathParameters: pathParameters, queryParameters: queryParameters, extra: extra, ); void safePop() { // If there is only one route on the stack, navigate to the initial // page instead of popping. if (canPop()) { pop(); } else { go('/'); } } } extension GoRouterExtensions on GoRouter { AppStateNotifier get appState => AppStateNotifier.instance; void prepareAuthEvent([bool ignoreRedirect = false]) => appState.hasRedirect() && !ignoreRedirect ? null : appState.updateNotifyOnAuthChange(false); bool shouldRedirect(bool ignoreRedirect) => !ignoreRedirect && appState.hasRedirect(); void clearRedirectLocation() => appState.clearRedirectLocation(); void setRedirectLocationIfUnset(String location) => appState.updateNotifyOnAuthChange(false); } extension _GoRouterStateExtensions on GoRouterState { Map<String, dynamic> get extraMap => extra != null ? extra as Map<String, dynamic> : {}; Map<String, dynamic> get allParams => <String, dynamic>{} ..addAll(pathParameters) ..addAll(queryParameters) ..addAll(extraMap); TransitionInfo get transitionInfo => extraMap.containsKey(kTransitionInfoKey) ? extraMap[kTransitionInfoKey] as TransitionInfo : TransitionInfo.appDefault(); } class FFParameters { FFParameters(this.state, [this.asyncParams = const {}]); final GoRouterState state; final Map<String, Future<dynamic> Function(String)> asyncParams; Map<String, dynamic> futureParamValues = {}; // Parameters are empty if the params map is empty or if the only parameter // present is the special extra parameter reserved for the transition info. bool get isEmpty => state.allParams.isEmpty || (state.extraMap.length == 1 && state.extraMap.containsKey(kTransitionInfoKey)); bool isAsyncParam(MapEntry<String, dynamic> param) => asyncParams.containsKey(param.key) && param.value is String; bool get hasFutures => state.allParams.entries.any(isAsyncParam); Future<bool> completeFutures() => Future.wait( state.allParams.entries.where(isAsyncParam).map( (param) async { final doc = await asyncParams[param.key]!(param.value) .onError((_, __) => null); if (doc != null) { futureParamValues[param.key] = doc; return true; } return false; }, ), ).onError((_, __) => [false]).then((v) => v.every((e) => e)); dynamic getParam<T>( String paramName, ParamType type, [ bool isList = false, List<String>? collectionNamePath, ]) { if (futureParamValues.containsKey(paramName)) { return futureParamValues[paramName]; } if (!state.allParams.containsKey(paramName)) { return null; } final param = state.allParams[paramName]; // Got parameter from `extras`, so just directly return it. if (param is! String) { return param; } // Return serialized value. return deserializeParam<T>(param, type, isList, collectionNamePath: collectionNamePath); } } class FFRoute { const FFRoute({ required this.name, required this.path, required this.builder, this.requireAuth = false, this.asyncParams = const {}, this.routes = const [], }); final String name; final String path; final bool requireAuth; final Map<String, Future<dynamic> Function(String)> asyncParams; final Widget Function(BuildContext, FFParameters) builder; final List<GoRoute> routes; GoRoute toRoute(AppStateNotifier appStateNotifier) => GoRoute( name: name, path: path, redirect: (context, state) { if (appStateNotifier.shouldRedirect) { final redirectLocation = appStateNotifier.getRedirectLocation(); appStateNotifier.clearRedirectLocation(); return redirectLocation; } if (requireAuth && !appStateNotifier.loggedIn) { appStateNotifier.setRedirectLocationIfUnset(state.location); return '/getStarted'; } return null; }, pageBuilder: (context, state) { final ffParams = FFParameters(state, asyncParams); final page = ffParams.hasFutures ? FutureBuilder( future: ffParams.completeFutures(), builder: (context, _) => builder(context, ffParams), ) : builder(context, ffParams); final child = appStateNotifier.loading ? Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ) : page; final transitionInfo = state.transitionInfo; return transitionInfo.hasTransition ? CustomTransitionPage( key: state.pageKey, child: child, transitionDuration: transitionInfo.duration, transitionsBuilder: (context, animation, secondaryAnimation, child) => PageTransition( type: transitionInfo.transitionType, duration: transitionInfo.duration, reverseDuration: transitionInfo.duration, alignment: transitionInfo.alignment, child: child, ).buildTransitions( context, animation, secondaryAnimation, child, ), ) : MaterialPage(key: state.pageKey, child: child); }, routes: routes, ); } class TransitionInfo { const TransitionInfo({ required this.hasTransition, this.transitionType = PageTransitionType.fade, this.duration = const Duration(milliseconds: 300), this.alignment, }); final bool hasTransition; final PageTransitionType transitionType; final Duration duration; final Alignment? alignment; static TransitionInfo appDefault() => TransitionInfo(hasTransition: false); } class RootPageContext { const RootPageContext(this.isRootPage, [this.errorRoute]); final bool isRootPage; final String? errorRoute; static bool isInactiveRootPage(BuildContext context) { final rootPageContext = context.read<RootPageContext?>(); final isRootPage = rootPageContext?.isRootPage ?? false; final location = GoRouter.of(context).location; return isRootPage && location != '/' && location != rootPageContext?.errorRoute; } static Widget wrap(Widget child, {String? errorRoute}) => Provider.value( value: RootPageContext(true, errorRoute), child: child, ); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/custom_code
mirrored_repositories/flutterflow_ecommerce_app/lib/custom_code/actions/new_custom_action.dart
// Automatic FlutterFlow imports import '/backend/backend.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'index.dart'; // Imports other custom actions import '/flutter_flow/custom_functions.dart'; // Imports custom functions import 'package:flutter/material.dart'; // Begin custom action code // DO NOT REMOVE OR MODIFY THE CODE ABOVE! Future newCustomAction(Future<dynamic> Function() callback) async { return callback(); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/custom_code
mirrored_repositories/flutterflow_ecommerce_app/lib/custom_code/actions/index.dart
export 'new_custom_action.dart' show newCustomAction;
0
mirrored_repositories/flutterflow_ecommerce_app/lib/custom_code
mirrored_repositories/flutterflow_ecommerce_app/lib/custom_code/widgets/range_slider_widget.dart
// Automatic FlutterFlow imports import '/backend/backend.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'index.dart'; // Imports other custom widgets import '/custom_code/actions/index.dart'; // Imports custom actions import '/flutter_flow/custom_functions.dart'; // Imports custom functions import 'package:flutter/material.dart'; // Begin custom widget code // DO NOT REMOVE OR MODIFY THE CODE ABOVE! class RangeSliderWidget extends StatefulWidget { const RangeSliderWidget({ Key? key, this.width, this.height, this.start = 0, this.end = 100, this.activeColor, this.inactiveColor, this.trackheight = 4.0, this.onChanged, }) : super(key: key); final double? width, height, start, end, trackheight; final Color? activeColor, inactiveColor; final void Function()? onChanged; @override _RangeSliderWidgetState createState() => _RangeSliderWidgetState(); } class _RangeSliderWidgetState extends State<RangeSliderWidget> { double? startValue; double? endValue; @override Widget build(BuildContext context) { return SliderTheme( data: SliderTheme.of(context).copyWith( trackHeight: widget.trackheight ?? 4.0, ), child: SizedBox( width: widget.width, height: widget.height, child: RangeSlider( activeColor: widget.activeColor, inactiveColor: widget.inactiveColor, values: RangeValues( startValue ?? widget.start ?? 0, endValue ?? widget.end ?? 100), max: widget.end ?? 100, onChanged: (RangeValues values) { setState(() { startValue = values.start; endValue = values.end; }); FFAppState().filterPriceLower = (startValue ?? 0).round(); FFAppState().filterPriceHigher = (endValue ?? 0).round(); widget.onChanged?.call(); }, ), ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/custom_code
mirrored_repositories/flutterflow_ecommerce_app/lib/custom_code/widgets/index.dart
export 'range_slider_widget.dart' show RangeSliderWidget;
0
mirrored_repositories/flutterflow_ecommerce_app/lib/navigation
mirrored_repositories/flutterflow_ecommerce_app/lib/navigation/bottom_navigation_bar/bottom_navigation_bar_model.dart
import '/auth/firebase_auth/auth_util.dart'; import '/backend/backend.dart'; import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'bottom_navigation_bar_widget.dart' show BottomNavigationBarWidget; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:flutter_animate/flutter_animate.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class BottomNavigationBarModel extends FlutterFlowModel<BottomNavigationBarWidget> { /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/navigation
mirrored_repositories/flutterflow_ecommerce_app/lib/navigation/bottom_navigation_bar/bottom_navigation_bar_widget.dart
import '/auth/firebase_auth/auth_util.dart'; import '/backend/backend.dart'; import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:flutter_animate/flutter_animate.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'bottom_navigation_bar_model.dart'; export 'bottom_navigation_bar_model.dart'; class BottomNavigationBarWidget extends StatefulWidget { const BottomNavigationBarWidget({Key? key}) : super(key: key); @override _BottomNavigationBarWidgetState createState() => _BottomNavigationBarWidgetState(); } class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> with TickerProviderStateMixin { late BottomNavigationBarModel _model; final animationsMap = { 'columnOnActionTriggerAnimation': AnimationInfo( trigger: AnimationTrigger.onActionTrigger, applyInitialState: true, effects: [ FadeEffect( curve: Curves.easeInOut, delay: 0.ms, duration: 600.ms, begin: 0.0, end: 1.0, ), ], ), }; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => BottomNavigationBarModel()); setupAnimations( animationsMap.values.where((anim) => anim.trigger == AnimationTrigger.onActionTrigger || !anim.applyInitialState), this, ); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Container( width: double.infinity, height: 66.0, decoration: BoxDecoration(), child: Stack( children: [ Align( alignment: AlignmentDirectional(0.0, 1.0), child: Container( width: double.infinity, height: 53.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, boxShadow: [ BoxShadow( blurRadius: 15.0, color: Color(0x0E000000), offset: Offset(5.0, 0.0), spreadRadius: 0.0, ) ], borderRadius: BorderRadius.only( bottomLeft: Radius.circular(0.0), bottomRight: Radius.circular(0.0), topLeft: Radius.circular(24.0), topRight: Radius.circular(24.0), ), ), child: Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Flexible( flex: 1, child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { _model.updatePage(() { FFAppState().pageNumber = 1; }); }, child: Container( width: double.infinity, height: 53.0, decoration: BoxDecoration(), child: Builder( builder: (context) { if (FFAppState().pageNumber == 1) { return Column( mainAxisSize: MainAxisSize.max, children: [ Flexible( child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/home_icon_filled.svg', width: double.infinity, height: 200.0, fit: BoxFit.scaleDown, ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 4.0, 0.0, 8.0), child: Text( 'Home', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .tertiary, fontSize: 10.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ], ); } else { return Column( mainAxisSize: MainAxisSize.max, children: [ Flexible( child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/home_icon.svg', width: double.infinity, height: 200.0, fit: BoxFit.scaleDown, ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 4.0, 0.0, 8.0), child: Text( 'Home', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .primaryBackground, fontSize: 10.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ], ); } }, ), ), ), ), Expanded( flex: 1, child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { _model.updatePage(() { FFAppState().pageNumber = 2; }); }, child: Container( width: double.infinity, height: 53.0, decoration: BoxDecoration(), child: Builder( builder: (context) { if (FFAppState().pageNumber == 2) { return Column( mainAxisSize: MainAxisSize.max, children: [ Flexible( child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/catalogue_icon_filled.svg', width: double.infinity, height: 200.0, fit: BoxFit.scaleDown, ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 4.0, 0.0, 8.0), child: Text( 'Catalogue', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .tertiary, fontSize: 10.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ], ); } else { return Column( mainAxisSize: MainAxisSize.max, children: [ Flexible( child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/catalogue_icon.svg', width: double.infinity, height: 200.0, fit: BoxFit.scaleDown, ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 4.0, 0.0, 8.0), child: Text( 'Catalogue', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .primaryBackground, fontSize: 10.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ], ); } }, ), ), ), ), Expanded( flex: 1, child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { _model.updatePage(() { FFAppState().pageNumber = 3; }); }, child: Container( width: double.infinity, height: 53.0, decoration: BoxDecoration(), child: Builder( builder: (context) { if (FFAppState().pageNumber == 3) { return Column( mainAxisSize: MainAxisSize.max, children: [ Flexible( child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/favorite_icon_filled.svg', width: double.infinity, height: 200.0, fit: BoxFit.scaleDown, ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 4.0, 0.0, 8.0), child: Text( 'Favorite', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .tertiary, fontSize: 10.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ], ); } else { return Column( mainAxisSize: MainAxisSize.max, children: [ Flexible( child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/favorite_icon.svg', width: double.infinity, height: 200.0, fit: BoxFit.scaleDown, ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 4.0, 0.0, 8.0), child: Text( 'Favorite', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .primaryBackground, fontSize: 10.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ], ); } }, ), ), ), ), Expanded( flex: 1, child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { _model.updatePage(() { FFAppState().pageNumber = 4; }); }, child: Container( width: double.infinity, height: 53.0, decoration: BoxDecoration(), child: Builder( builder: (context) { if (FFAppState().pageNumber == 4) { return Column( mainAxisSize: MainAxisSize.max, children: [ Flexible( child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/profile_icon_filled.svg', width: double.infinity, height: 200.0, fit: BoxFit.scaleDown, ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 4.0, 0.0, 8.0), child: Text( 'Profile', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .tertiary, fontSize: 10.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ], ); } else { return Column( mainAxisSize: MainAxisSize.max, children: [ Flexible( child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/profile_icon.svg', width: double.infinity, height: 200.0, fit: BoxFit.scaleDown, ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 4.0, 0.0, 8.0), child: Text( 'Profile', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .primaryBackground, fontSize: 10.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ], ); } }, ), ), ), ), AnimatedContainer( duration: Duration(milliseconds: 600), curve: Curves.easeIn, width: FFAppState().cartOpened ? 116.0 : 50.0, height: 53.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, ), ), ], ), ), ), Align( alignment: AlignmentDirectional(1.0, -1.0), child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { if (!FFAppState().cartOpened) { setState(() { FFAppState().cartOpened = true; }); } else { context.pushNamed('CartPage'); return; } if (animationsMap['columnOnActionTriggerAnimation'] != null) { await animationsMap['columnOnActionTriggerAnimation']! .controller .forward(from: 0.0); } await Future.delayed(const Duration(milliseconds: 3000)); _model.updatePage(() { FFAppState().cartOpened = false; }); if (animationsMap['columnOnActionTriggerAnimation'] != null) { await animationsMap['columnOnActionTriggerAnimation']! .controller .reverse(); } }, child: AnimatedContainer( duration: Duration(milliseconds: 600), curve: Curves.easeIn, width: FFAppState().cartOpened ? 116.0 : 50.0, height: 56.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).primary, FlutterFlowTheme.of(context).secondary ], stops: [0.0, 1.0], begin: AlignmentDirectional(-1.0, 0.34), end: AlignmentDirectional(1.0, -0.34), ), borderRadius: BorderRadius.only( bottomLeft: Radius.circular(80.0), bottomRight: Radius.circular(0.0), topLeft: Radius.circular(80.0), topRight: Radius.circular(0.0), ), ), child: Row( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 0.0, 0.0), child: Icon( Icons.shopping_cart_outlined, color: FlutterFlowTheme.of(context).info, size: 24.0, ), ), Column( mainAxisSize: MainAxisSize.min, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 0.0, 2.0), child: StreamBuilder<List<CartRecord>>( stream: queryCartRecord( queryBuilder: (cartRecord) => cartRecord.where( 'user_id', isEqualTo: currentUserUid, ), singleRecord: true, ), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<CartRecord> textCartRecordList = snapshot.data!; // Return an empty Container when the item does not exist. if (snapshot.data!.isEmpty) { return Container(); } final textCartRecord = textCartRecordList.isNotEmpty ? textCartRecordList.first : null; return Text( '\$${formatNumber( textCartRecord?.price, formatType: FormatType.custom, format: '##0.00', locale: '', )}', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .secondaryBackground, fontSize: 11.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ); }, ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 2.0, 0.0, 0.0), child: StreamBuilder<List<CartRecord>>( stream: queryCartRecord( queryBuilder: (cartRecord) => cartRecord.where( 'user_id', isEqualTo: currentUserUid, ), singleRecord: true, ), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<CartRecord> textCartRecordList = snapshot.data!; // Return an empty Container when the item does not exist. if (snapshot.data!.isEmpty) { return Container(); } final textCartRecord = textCartRecordList.isNotEmpty ? textCartRecordList.first : null; return Text( '${textCartRecord?.content?.length?.toString()} items', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: Color(0x98FFFFFF), fontSize: 11.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ); }, ), ), ], ).animateOnActionTrigger( animationsMap['columnOnActionTriggerAnimation']!, ), ], ), ), ), ), ], ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/navigation
mirrored_repositories/flutterflow_ecommerce_app/lib/navigation/navigation/navigation_widget.dart
import '/catalogue/catalogue/catalogue_widget.dart'; import '/catalogue/catalogue_app_bar/catalogue_app_bar_widget.dart'; import '/favorite/favorite/favorite_widget.dart'; import '/favorite/favorite_app_bar/favorite_app_bar_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_widgets.dart'; import '/home/home/home_widget.dart'; import '/home/home_app_bar/home_app_bar_widget.dart'; import '/navigation/bottom_navigation_bar/bottom_navigation_bar_widget.dart'; import '/profile/profile/profile_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'navigation_model.dart'; export 'navigation_model.dart'; class NavigationWidget extends StatefulWidget { const NavigationWidget({Key? key}) : super(key: key); @override _NavigationWidgetState createState() => _NavigationWidgetState(); } class _NavigationWidgetState extends State<NavigationWidget> { late NavigationModel _model; final scaffoldKey = GlobalKey<ScaffoldState>(); @override void initState() { super.initState(); _model = createModel(context, () => NavigationModel()); } @override void dispose() { _model.dispose(); super.dispose(); } @override Widget build(BuildContext context) { if (isiOS) { SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle( statusBarBrightness: Theme.of(context).brightness, systemStatusBarContrastEnforced: true, ), ); } context.watch<FFAppState>(); return GestureDetector( onTap: () => _model.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(_model.unfocusNode) : FocusScope.of(context).unfocus(), child: Scaffold( key: scaffoldKey, backgroundColor: Color(0xFFF4F3F4), appBar: FFAppState().pageNumber != 4 ? AppBar( automaticallyImplyLeading: false, actions: [], flexibleSpace: FlexibleSpaceBar( background: Container( width: 100.0, height: 100.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).primary, FlutterFlowTheme.of(context).secondary ], stops: [0.0, 1.0], begin: AlignmentDirectional(-1.0, 0.0), end: AlignmentDirectional(1.0, 0), ), ), ), ), centerTitle: false, elevation: 0.0, ) : null, body: SafeArea( top: true, child: Column( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.end, children: [ Expanded( child: Stack( alignment: AlignmentDirectional(0.0, 1.0), children: [ Builder( builder: (context) { if (FFAppState().pageNumber == 1) { return wrapWithModel( model: _model.homeModel, updateCallback: () => setState(() {}), child: HomeWidget(), ); } else if (FFAppState().pageNumber == 2) { return wrapWithModel( model: _model.catalogueModel, updateCallback: () => setState(() {}), child: CatalogueWidget(), ); } else if (FFAppState().pageNumber == 3) { return wrapWithModel( model: _model.favoriteModel, updateCallback: () => setState(() {}), child: FavoriteWidget(), ); } else { return wrapWithModel( model: _model.profileModel, updateCallback: () => setState(() {}), child: ProfileWidget(), ); } }, ), wrapWithModel( model: _model.bottomNavigationBarModel, updateCallback: () => setState(() {}), child: BottomNavigationBarWidget(), ), Align( alignment: AlignmentDirectional(0.0, -1.0), child: Builder( builder: (context) { if (FFAppState().pageNumber == 1) { return wrapWithModel( model: _model.homeAppBarModel, updateCallback: () => setState(() {}), child: HomeAppBarWidget(), ); } else if (FFAppState().pageNumber == 2) { return wrapWithModel( model: _model.catalogueAppBarModel, updateCallback: () => setState(() {}), child: CatalogueAppBarWidget(), ); } else if (FFAppState().pageNumber == 3) { return wrapWithModel( model: _model.favoriteAppBarModel, updateCallback: () => setState(() {}), child: FavoriteAppBarWidget(), ); } else { return Container( width: 0.0, height: 0.0, decoration: BoxDecoration(), ); } }, ), ), ], ), ), ], ), ), ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/navigation
mirrored_repositories/flutterflow_ecommerce_app/lib/navigation/navigation/navigation_model.dart
import '/catalogue/catalogue/catalogue_widget.dart'; import '/catalogue/catalogue_app_bar/catalogue_app_bar_widget.dart'; import '/favorite/favorite/favorite_widget.dart'; import '/favorite/favorite_app_bar/favorite_app_bar_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_widgets.dart'; import '/home/home/home_widget.dart'; import '/home/home_app_bar/home_app_bar_widget.dart'; import '/navigation/bottom_navigation_bar/bottom_navigation_bar_widget.dart'; import '/profile/profile/profile_widget.dart'; import 'navigation_widget.dart' show NavigationWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class NavigationModel extends FlutterFlowModel<NavigationWidget> { /// State fields for stateful widgets in this page. final unfocusNode = FocusNode(); // Model for Home component. late HomeModel homeModel; // Model for Catalogue component. late CatalogueModel catalogueModel; // Model for Favorite component. late FavoriteModel favoriteModel; // Model for Profile component. late ProfileModel profileModel; // Model for BottomNavigationBar component. late BottomNavigationBarModel bottomNavigationBarModel; // Model for HomeAppBar component. late HomeAppBarModel homeAppBarModel; // Model for CatalogueAppBar component. late CatalogueAppBarModel catalogueAppBarModel; // Model for FavoriteAppBar component. late FavoriteAppBarModel favoriteAppBarModel; /// Initialization and disposal methods. void initState(BuildContext context) { homeModel = createModel(context, () => HomeModel()); catalogueModel = createModel(context, () => CatalogueModel()); favoriteModel = createModel(context, () => FavoriteModel()); profileModel = createModel(context, () => ProfileModel()); bottomNavigationBarModel = createModel(context, () => BottomNavigationBarModel()); homeAppBarModel = createModel(context, () => HomeAppBarModel()); catalogueAppBarModel = createModel(context, () => CatalogueAppBarModel()); favoriteAppBarModel = createModel(context, () => FavoriteAppBarModel()); } void dispose() { unfocusNode.dispose(); homeModel.dispose(); catalogueModel.dispose(); favoriteModel.dispose(); profileModel.dispose(); bottomNavigationBarModel.dispose(); homeAppBarModel.dispose(); catalogueAppBarModel.dispose(); favoriteAppBarModel.dispose(); } /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/favorite
mirrored_repositories/flutterflow_ecommerce_app/lib/favorite/favorite_app_bar/favorite_app_bar_widget.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'favorite_app_bar_model.dart'; export 'favorite_app_bar_model.dart'; class FavoriteAppBarWidget extends StatefulWidget { const FavoriteAppBarWidget({Key? key}) : super(key: key); @override _FavoriteAppBarWidgetState createState() => _FavoriteAppBarWidgetState(); } class _FavoriteAppBarWidgetState extends State<FavoriteAppBarWidget> { late FavoriteAppBarModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => FavoriteAppBarModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Align( alignment: AlignmentDirectional(0.0, -1.0), child: Container( width: double.infinity, height: 44.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).primary, FlutterFlowTheme.of(context).secondary ], stops: [0.0, 1.0], begin: AlignmentDirectional(-1.0, 0.0), end: AlignmentDirectional(1.0, 0), ), ), child: Column( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/back.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), Expanded( child: Align( alignment: AlignmentDirectional(0.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 24.0, 0.0), child: Text( 'Favorite', style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Display', color: FlutterFlowTheme.of(context) .secondaryBackground, fontSize: 19.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ), ), ], ), ), ], ), ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/favorite
mirrored_repositories/flutterflow_ecommerce_app/lib/favorite/favorite_app_bar/favorite_app_bar_model.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'favorite_app_bar_widget.dart' show FavoriteAppBarWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class FavoriteAppBarModel extends FlutterFlowModel<FavoriteAppBarWidget> { /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/favorite
mirrored_repositories/flutterflow_ecommerce_app/lib/favorite/favorite/favorite_model.dart
import '/auth/firebase_auth/auth_util.dart'; import '/backend/backend.dart'; import '/components/product_widget.dart'; import '/flutter_flow/flutter_flow_drop_down.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/form_field_controller.dart'; import 'favorite_widget.dart' show FavoriteWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class FavoriteModel extends FlutterFlowModel<FavoriteWidget> { /// State fields for stateful widgets in this component. // State field(s) for DropDown widget. String? dropDownValue; FormFieldController<String>? dropDownValueController; /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/favorite
mirrored_repositories/flutterflow_ecommerce_app/lib/favorite/favorite/favorite_widget.dart
import '/auth/firebase_auth/auth_util.dart'; import '/backend/backend.dart'; import '/components/product_widget.dart'; import '/flutter_flow/flutter_flow_drop_down.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/form_field_controller.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'favorite_model.dart'; export 'favorite_model.dart'; class FavoriteWidget extends StatefulWidget { const FavoriteWidget({Key? key}) : super(key: key); @override _FavoriteWidgetState createState() => _FavoriteWidgetState(); } class _FavoriteWidgetState extends State<FavoriteWidget> { late FavoriteModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => FavoriteModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 68.0, 16.0, 0.0), child: Column( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( mainAxisSize: MainAxisSize.max, children: [ Expanded( child: FutureBuilder<int>( future: queryProductsRecordCount( queryBuilder: (productsRecord) => productsRecord.where( 'in_favorites', arrayContains: currentUserUid, ), ), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } int textCount = snapshot.data!; return Text( '${textCount.toString()} items', style: FlutterFlowTheme.of(context).bodyMedium, ); }, ), ), Row( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 4.0, 0.0), child: Text( 'Sort by:', style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context).primaryBackground, fontSize: 12.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), FlutterFlowDropDown<String>( controller: _model.dropDownValueController ??= FormFieldController<String>( _model.dropDownValue ??= 'ASC', ), options: List<String>.from(['ASC', 'DESC']), optionLabels: ['lowest to hight', 'highest to low'], onChanged: (val) => setState(() => _model.dropDownValue = val), width: 120.0, height: 40.0, textStyle: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Text', fontSize: 12.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), icon: Icon( Icons.keyboard_arrow_down_rounded, color: FlutterFlowTheme.of(context).primaryText, size: 24.0, ), elevation: 0.0, borderColor: Colors.transparent, borderWidth: 0.0, borderRadius: 8.0, margin: EdgeInsets.all(0.0), hidesUnderline: true, isSearchable: false, isMultiSelect: false, ), ], ), ], ), Builder( builder: (context) { if (_model.dropDownValue == 'ASC') { return Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 16.0, 16.0, 53.0), child: StreamBuilder<List<ProductsRecord>>( stream: queryProductsRecord( queryBuilder: (productsRecord) => productsRecord .where( 'in_favorites', arrayContains: currentUserUid, ) .orderBy('price'), ), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<ProductsRecord> gridViewProductsRecordList = snapshot.data!; return GridView.builder( padding: EdgeInsets.zero, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 17.0, mainAxisSpacing: 24.0, childAspectRatio: 0.6, ), primary: false, shrinkWrap: true, scrollDirection: Axis.vertical, itemCount: gridViewProductsRecordList.length, itemBuilder: (context, gridViewIndex) { final gridViewProductsRecord = gridViewProductsRecordList[gridViewIndex]; return ProductWidget( key: Key( 'Keyxc8_${gridViewIndex}_of_${gridViewProductsRecordList.length}'), discount: gridViewProductsRecord.discount, image: gridViewProductsRecord.imagesUrl.first, raiting: gridViewProductsRecord.raiting, title: gridViewProductsRecord.title, price: gridViewProductsRecord.price, discountPrice: gridViewProductsRecord.discountPrice, isFavorite: gridViewProductsRecord.inFavorites .contains(currentUserUid) == true, docRef: gridViewProductsRecord.reference, doc: gridViewProductsRecord, ); }, ); }, ), ); } else { return Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 16.0, 16.0, 53.0), child: StreamBuilder<List<ProductsRecord>>( stream: queryProductsRecord( queryBuilder: (productsRecord) => productsRecord .where( 'in_favorites', arrayContains: currentUserUid, ) .orderBy('price', descending: true), ), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<ProductsRecord> gridViewProductsRecordList = snapshot.data!; return GridView.builder( padding: EdgeInsets.zero, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 17.0, mainAxisSpacing: 24.0, childAspectRatio: 0.6, ), primary: false, shrinkWrap: true, scrollDirection: Axis.vertical, itemCount: gridViewProductsRecordList.length, itemBuilder: (context, gridViewIndex) { final gridViewProductsRecord = gridViewProductsRecordList[gridViewIndex]; return ProductWidget( key: Key( 'Keyy8e_${gridViewIndex}_of_${gridViewProductsRecordList.length}'), discount: gridViewProductsRecord.discount, image: gridViewProductsRecord.imagesUrl.first, raiting: gridViewProductsRecord.raiting, title: gridViewProductsRecord.title, price: gridViewProductsRecord.price, discountPrice: gridViewProductsRecord.discountPrice, isFavorite: gridViewProductsRecord.inFavorites .contains(currentUserUid) == true, docRef: gridViewProductsRecord.reference, doc: gridViewProductsRecord, ); }, ); }, ), ); } }, ), ], ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/auth_manager.dart
import 'package:flutter/material.dart'; import 'base_auth_user_provider.dart'; abstract class AuthManager { Future signOut(); Future deleteUser(BuildContext context); Future updateEmail({required String email, required BuildContext context}); Future resetPassword({required String email, required BuildContext context}); Future sendEmailVerification() async => currentUser?.sendEmailVerification(); Future refreshUser() async => currentUser?.refreshUser(); } mixin EmailSignInManager on AuthManager { Future<BaseAuthUser?> signInWithEmail( BuildContext context, String email, String password, ); Future<BaseAuthUser?> createAccountWithEmail( BuildContext context, String email, String password, ); } mixin AnonymousSignInManager on AuthManager { Future<BaseAuthUser?> signInAnonymously(BuildContext context); } mixin AppleSignInManager on AuthManager { Future<BaseAuthUser?> signInWithApple(BuildContext context); } mixin GoogleSignInManager on AuthManager { Future<BaseAuthUser?> signInWithGoogle(BuildContext context); } mixin JwtSignInManager on AuthManager { Future<BaseAuthUser?> signInWithJwtToken( BuildContext context, String jwtToken, ); } mixin PhoneSignInManager on AuthManager { Future beginPhoneAuth({ required BuildContext context, required String phoneNumber, required void Function(BuildContext) onCodeSent, }); Future verifySmsCode({ required BuildContext context, required String smsCode, }); } mixin FacebookSignInManager on AuthManager { Future<BaseAuthUser?> signInWithFacebook(BuildContext context); } mixin MicrosoftSignInManager on AuthManager { Future<BaseAuthUser?> signInWithMicrosoft( BuildContext context, List<String> scopes, String tenantId, ); } mixin GithubSignInManager on AuthManager { Future<BaseAuthUser?> signInWithGithub(BuildContext context); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/base_auth_user_provider.dart
class AuthUserInfo { const AuthUserInfo({ this.uid, this.email, this.displayName, this.photoUrl, this.phoneNumber, }); final String? uid; final String? email; final String? displayName; final String? photoUrl; final String? phoneNumber; } abstract class BaseAuthUser { bool get loggedIn; bool get emailVerified; AuthUserInfo get authUserInfo; Future? delete(); Future? updateEmail(String email); Future? sendEmailVerification(); Future refreshUser() async {} String? get uid => authUserInfo.uid; String? get email => authUserInfo.email; String? get displayName => authUserInfo.displayName; String? get photoUrl => authUserInfo.photoUrl; String? get phoneNumber => authUserInfo.phoneNumber; } BaseAuthUser? currentUser; bool get loggedIn => currentUser?.loggedIn ?? false;
0
mirrored_repositories/flutterflow_ecommerce_app/lib/auth
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/firebase_auth/apple_auth.dart
import 'dart:convert'; import 'dart:math'; import 'package:crypto/crypto.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/foundation.dart'; import 'package:sign_in_with_apple/sign_in_with_apple.dart'; /// Generates a cryptographically secure random nonce, to be included in a /// credential request. String generateNonce([int length = 32]) { final charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._'; final random = Random.secure(); return List.generate(length, (_) => charset[random.nextInt(charset.length)]) .join(); } /// Returns the sha256 hash of [input] in hex notation. String sha256ofString(String input) { final bytes = utf8.encode(input); final digest = sha256.convert(bytes); return digest.toString(); } Future<UserCredential> appleSignIn() async { if (kIsWeb) { final provider = OAuthProvider("apple.com") ..addScope('email') ..addScope('name'); // Sign in the user with Firebase. return await FirebaseAuth.instance.signInWithPopup(provider); } // To prevent replay attacks with the credential returned from Apple, we // include a nonce in the credential request. When signing in in with // Firebase, the nonce in the id token returned by Apple, is expected to // match the sha256 hash of `rawNonce`. final rawNonce = generateNonce(); final nonce = sha256ofString(rawNonce); // Request credential for the currently signed in Apple account. final appleCredential = await SignInWithApple.getAppleIDCredential( scopes: [ AppleIDAuthorizationScopes.email, AppleIDAuthorizationScopes.fullName, ], nonce: nonce, ); // Create an `OAuthCredential` from the credential returned by Apple. final oauthCredential = OAuthProvider("apple.com").credential( idToken: appleCredential.identityToken, rawNonce: rawNonce, ); // Sign in the user with Firebase. If the nonce we generated earlier does // not match the nonce in `appleCredential.identityToken`, sign in will fail. final user = await FirebaseAuth.instance.signInWithCredential(oauthCredential); final displayName = [appleCredential.givenName, appleCredential.familyName] .where((name) => name != null) .join(' '); // The display name does not automatically come with the user. if (displayName.isNotEmpty) { await user.user?.updateDisplayName(displayName); } return user; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/auth
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/firebase_auth/github_auth.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/foundation.dart'; // https://firebase.flutter.dev/docs/auth/social/#github Future<UserCredential?> githubSignInFunc() async { // Create a new provider GithubAuthProvider githubProvider = GithubAuthProvider(); // Once signed in, return the UserCredential return await FirebaseAuth.instance.signInWithPopup(githubProvider); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/auth
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/firebase_auth/firebase_user_provider.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:rxdart/rxdart.dart'; import '../base_auth_user_provider.dart'; export '../base_auth_user_provider.dart'; class MyShopFlutterFlowFirebaseUser extends BaseAuthUser { MyShopFlutterFlowFirebaseUser(this.user); User? user; bool get loggedIn => user != null; @override AuthUserInfo get authUserInfo => AuthUserInfo( uid: user?.uid, email: user?.email, displayName: user?.displayName, photoUrl: user?.photoURL, phoneNumber: user?.phoneNumber, ); @override Future? delete() => user?.delete(); @override Future? updateEmail(String email) async { try { await user?.updateEmail(email); } catch (_) { await user?.verifyBeforeUpdateEmail(email); } } @override Future? sendEmailVerification() => user?.sendEmailVerification(); @override bool get emailVerified { // Reloads the user when checking in order to get the most up to date // email verified status. if (loggedIn && !user!.emailVerified) { refreshUser(); } return user?.emailVerified ?? false; } @override Future refreshUser() async { await FirebaseAuth.instance.currentUser ?.reload() .then((_) => user = FirebaseAuth.instance.currentUser); } static BaseAuthUser fromUserCredential(UserCredential userCredential) => fromFirebaseUser(userCredential.user); static BaseAuthUser fromFirebaseUser(User? user) => MyShopFlutterFlowFirebaseUser(user); } Stream<BaseAuthUser> myShopFlutterFlowFirebaseUserStream() => FirebaseAuth.instance .authStateChanges() .debounce((user) => user == null && !loggedIn ? TimerStream(true, const Duration(seconds: 1)) : Stream.value(user)) .map<BaseAuthUser>( (user) { currentUser = MyShopFlutterFlowFirebaseUser(user); return currentUser!; }, );
0
mirrored_repositories/flutterflow_ecommerce_app/lib/auth
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/firebase_auth/auth_util.dart
import 'dart:async'; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import '../auth_manager.dart'; import '../base_auth_user_provider.dart'; import '../../flutter_flow/flutter_flow_util.dart'; import '/backend/backend.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:stream_transform/stream_transform.dart'; import 'firebase_auth_manager.dart'; export 'firebase_auth_manager.dart'; final _authManager = FirebaseAuthManager(); FirebaseAuthManager get authManager => _authManager; String get currentUserEmail => currentUserDocument?.email ?? currentUser?.email ?? ''; String get currentUserUid => currentUser?.uid ?? ''; String get currentUserDisplayName => currentUserDocument?.displayName ?? currentUser?.displayName ?? ''; String get currentUserPhoto => currentUserDocument?.photoUrl ?? currentUser?.photoUrl ?? ''; String get currentPhoneNumber => currentUserDocument?.phoneNumber ?? currentUser?.phoneNumber ?? ''; String get currentJwtToken => _currentJwtToken ?? ''; bool get currentUserEmailVerified => currentUser?.emailVerified ?? false; /// Create a Stream that listens to the current user's JWT Token, since Firebase /// generates a new token every hour. String? _currentJwtToken; final jwtTokenStream = FirebaseAuth.instance .idTokenChanges() .map((user) async => _currentJwtToken = await user?.getIdToken()) .asBroadcastStream(); DocumentReference? get currentUserReference => loggedIn ? UsersRecord.collection.doc(currentUser!.uid) : null; UsersRecord? currentUserDocument; final authenticatedUserStream = FirebaseAuth.instance .authStateChanges() .map<String>((user) => user?.uid ?? '') .switchMap( (uid) => uid.isEmpty ? Stream.value(null) : UsersRecord.getDocument(UsersRecord.collection.doc(uid)) .handleError((_) {}), ) .map((user) => currentUserDocument = user) .asBroadcastStream(); class AuthUserStreamWidget extends StatelessWidget { const AuthUserStreamWidget({Key? key, required this.builder}) : super(key: key); final WidgetBuilder builder; @override Widget build(BuildContext context) => StreamBuilder( stream: authenticatedUserStream, builder: (context, _) => builder(context), ); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/auth
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/firebase_auth/anonymous_auth.dart
import 'package:firebase_auth/firebase_auth.dart'; Future<UserCredential?> anonymousSignInFunc() => FirebaseAuth.instance.signInAnonymously();
0
mirrored_repositories/flutterflow_ecommerce_app/lib/auth
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/firebase_auth/jwt_token_auth.dart
import 'package:firebase_auth/firebase_auth.dart'; Future<UserCredential?> jwtTokenSignIn(String jwtToken) => FirebaseAuth.instance.signInWithCustomToken(jwtToken);
0
mirrored_repositories/flutterflow_ecommerce_app/lib/auth
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/firebase_auth/google_auth.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/foundation.dart'; import 'package:google_sign_in/google_sign_in.dart'; final _googleSignIn = GoogleSignIn(); Future<UserCredential?> googleSignInFunc() async { if (kIsWeb) { // Once signed in, return the UserCredential return await FirebaseAuth.instance.signInWithPopup(GoogleAuthProvider()); } await signOutWithGoogle().catchError((_) => null); final auth = await (await _googleSignIn.signIn())?.authentication; if (auth == null) { return null; } final credential = GoogleAuthProvider.credential( idToken: auth.idToken, accessToken: auth.accessToken); return FirebaseAuth.instance.signInWithCredential(credential); } Future signOutWithGoogle() => _googleSignIn.signOut();
0
mirrored_repositories/flutterflow_ecommerce_app/lib/auth
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/firebase_auth/email_auth.dart
import 'package:firebase_auth/firebase_auth.dart'; Future<UserCredential?> emailSignInFunc( String email, String password, ) => FirebaseAuth.instance .signInWithEmailAndPassword(email: email.trim(), password: password); Future<UserCredential?> emailCreateAccountFunc( String email, String password, ) => FirebaseAuth.instance.createUserWithEmailAndPassword( email: email.trim(), password: password, );
0
mirrored_repositories/flutterflow_ecommerce_app/lib/auth
mirrored_repositories/flutterflow_ecommerce_app/lib/auth/firebase_auth/firebase_auth_manager.dart
import 'dart:async'; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import '../auth_manager.dart'; import '../base_auth_user_provider.dart'; import '../../flutter_flow/flutter_flow_util.dart'; import '/backend/backend.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:stream_transform/stream_transform.dart'; import 'anonymous_auth.dart'; import 'apple_auth.dart'; import 'email_auth.dart'; import 'firebase_user_provider.dart'; import 'google_auth.dart'; import 'jwt_token_auth.dart'; import 'github_auth.dart'; export '../base_auth_user_provider.dart'; class FirebasePhoneAuthManager extends ChangeNotifier { bool? _triggerOnCodeSent; FirebaseAuthException? phoneAuthError; // Set when using phone verification (after phone number is provided). String? phoneAuthVerificationCode; // Set when using phone sign in in web mode (ignored otherwise). ConfirmationResult? webPhoneAuthConfirmationResult; // Used for handling verification codes for phone sign in. void Function(BuildContext)? _onCodeSent; bool get triggerOnCodeSent => _triggerOnCodeSent ?? false; set triggerOnCodeSent(bool val) => _triggerOnCodeSent = val; void Function(BuildContext) get onCodeSent => _onCodeSent == null ? (_) {} : _onCodeSent!; set onCodeSent(void Function(BuildContext) func) => _onCodeSent = func; void update(VoidCallback callback) { callback(); notifyListeners(); } } class FirebaseAuthManager extends AuthManager with EmailSignInManager, GoogleSignInManager, AppleSignInManager, AnonymousSignInManager, JwtSignInManager, GithubSignInManager, PhoneSignInManager { // Set when using phone verification (after phone number is provided). String? _phoneAuthVerificationCode; // Set when using phone sign in in web mode (ignored otherwise). ConfirmationResult? _webPhoneAuthConfirmationResult; FirebasePhoneAuthManager phoneAuthManager = FirebasePhoneAuthManager(); @override Future signOut() { return FirebaseAuth.instance.signOut(); } @override Future deleteUser(BuildContext context) async { try { if (!loggedIn) { print('Error: delete user attempted with no logged in user!'); return; } await currentUser?.delete(); } on FirebaseAuthException catch (e) { if (e.code == 'requires-recent-login') { ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( 'Too long since most recent sign in. Sign in again before deleting your account.')), ); } } } @override Future updateEmail({ required String email, required BuildContext context, }) async { try { if (!loggedIn) { print('Error: update email attempted with no logged in user!'); return; } await currentUser?.updateEmail(email); await updateUserDocument(email: email); } on FirebaseAuthException catch (e) { if (e.code == 'requires-recent-login') { ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( 'Too long since most recent sign in. Sign in again before updating your email.')), ); } } } @override Future resetPassword({ required String email, required BuildContext context, }) async { try { await FirebaseAuth.instance.sendPasswordResetEmail(email: email); } on FirebaseAuthException catch (e) { ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Error: ${e.message!}')), ); return null; } ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Password reset email sent')), ); } @override Future<BaseAuthUser?> signInWithEmail( BuildContext context, String email, String password, ) => _signInOrCreateAccount( context, () => emailSignInFunc(email, password), 'EMAIL', ); @override Future<BaseAuthUser?> createAccountWithEmail( BuildContext context, String email, String password, ) => _signInOrCreateAccount( context, () => emailCreateAccountFunc(email, password), 'EMAIL', ); @override Future<BaseAuthUser?> signInAnonymously( BuildContext context, ) => _signInOrCreateAccount(context, anonymousSignInFunc, 'ANONYMOUS'); @override Future<BaseAuthUser?> signInWithApple(BuildContext context) => _signInOrCreateAccount(context, appleSignIn, 'APPLE'); @override Future<BaseAuthUser?> signInWithGoogle(BuildContext context) => _signInOrCreateAccount(context, googleSignInFunc, 'GOOGLE'); @override Future<BaseAuthUser?> signInWithGithub(BuildContext context) => _signInOrCreateAccount(context, githubSignInFunc, 'GITHUB'); @override Future<BaseAuthUser?> signInWithJwtToken( BuildContext context, String jwtToken, ) => _signInOrCreateAccount(context, () => jwtTokenSignIn(jwtToken), 'JWT'); void handlePhoneAuthStateChanges(BuildContext context) { phoneAuthManager.addListener(() { if (!context.mounted) { return; } if (phoneAuthManager.triggerOnCodeSent) { phoneAuthManager.onCodeSent(context); phoneAuthManager .update(() => phoneAuthManager.triggerOnCodeSent = false); } else if (phoneAuthManager.phoneAuthError != null) { final e = phoneAuthManager.phoneAuthError!; ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text('Error: ${e.message!}'), )); phoneAuthManager.update(() => phoneAuthManager.phoneAuthError = null); } }); } @override Future beginPhoneAuth({ required BuildContext context, required String phoneNumber, required void Function(BuildContext) onCodeSent, }) async { phoneAuthManager.update(() => phoneAuthManager.onCodeSent = onCodeSent); if (kIsWeb) { phoneAuthManager.webPhoneAuthConfirmationResult = await FirebaseAuth.instance.signInWithPhoneNumber(phoneNumber); phoneAuthManager.update(() => phoneAuthManager.triggerOnCodeSent = true); return; } final completer = Completer<bool>(); // If you'd like auto-verification, without the user having to enter the SMS // code manually. Follow these instructions: // * For Android: https://firebase.google.com/docs/auth/android/phone-auth?authuser=0#enable-app-verification (SafetyNet set up) // * For iOS: https://firebase.google.com/docs/auth/ios/phone-auth?authuser=0#start-receiving-silent-notifications // * Finally modify verificationCompleted below as instructed. await FirebaseAuth.instance.verifyPhoneNumber( phoneNumber: phoneNumber, timeout: Duration(seconds: 0), // Skips Android's default auto-verification verificationCompleted: (phoneAuthCredential) async { await FirebaseAuth.instance.signInWithCredential(phoneAuthCredential); phoneAuthManager.update(() { phoneAuthManager.triggerOnCodeSent = false; phoneAuthManager.phoneAuthError = null; }); // If you've implemented auto-verification, navigate to home page or // onboarding page here manually. Uncomment the lines below and replace // DestinationPage() with the desired widget. // await Navigator.push( // context, // MaterialPageRoute(builder: (_) => DestinationPage()), // ); }, verificationFailed: (e) { phoneAuthManager.update(() { phoneAuthManager.triggerOnCodeSent = false; phoneAuthManager.phoneAuthError = e; }); completer.complete(false); }, codeSent: (verificationId, _) { phoneAuthManager.update(() { phoneAuthManager.phoneAuthVerificationCode = verificationId; phoneAuthManager.triggerOnCodeSent = true; phoneAuthManager.phoneAuthError = null; }); completer.complete(true); }, codeAutoRetrievalTimeout: (_) {}, ); return completer.future; } @override Future verifySmsCode({ required BuildContext context, required String smsCode, }) { if (kIsWeb) { return _signInOrCreateAccount( context, () => phoneAuthManager.webPhoneAuthConfirmationResult!.confirm(smsCode), 'PHONE', ); } else { final authCredential = PhoneAuthProvider.credential( verificationId: phoneAuthManager.phoneAuthVerificationCode!, smsCode: smsCode, ); return _signInOrCreateAccount( context, () => FirebaseAuth.instance.signInWithCredential(authCredential), 'PHONE', ); } } /// Tries to sign in or create an account using Firebase Auth. /// Returns the User object if sign in was successful. Future<BaseAuthUser?> _signInOrCreateAccount( BuildContext context, Future<UserCredential?> Function() signInFunc, String authProvider, ) async { try { final userCredential = await signInFunc(); if (userCredential?.user != null) { await maybeCreateUser(userCredential!.user!); } return userCredential == null ? null : MyShopFlutterFlowFirebaseUser.fromUserCredential(userCredential); } on FirebaseAuthException catch (e) { final errorMsg = e.message?.contains('auth/email-already-in-use') ?? false ? 'The email is already in use by a different account' : 'Error: ${e.message!}'; ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text(errorMsg)), ); return null; } } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/home
mirrored_repositories/flutterflow_ecommerce_app/lib/home/see_all/see_all_widget.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'see_all_model.dart'; export 'see_all_model.dart'; class SeeAllWidget extends StatefulWidget { const SeeAllWidget({Key? key}) : super(key: key); @override _SeeAllWidgetState createState() => _SeeAllWidgetState(); } class _SeeAllWidgetState extends State<SeeAllWidget> { late SeeAllModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => SeeAllModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, children: [ Text( 'See All', style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context).primaryBackground, fontSize: 12.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/vector.svg', width: 16.0, height: 16.0, fit: BoxFit.scaleDown, ), ), ], ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/home
mirrored_repositories/flutterflow_ecommerce_app/lib/home/see_all/see_all_model.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'see_all_widget.dart' show SeeAllWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class SeeAllModel extends FlutterFlowModel<SeeAllWidget> { /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/home
mirrored_repositories/flutterflow_ecommerce_app/lib/home/home/home_widget.dart
import '/auth/firebase_auth/auth_util.dart'; import '/backend/backend.dart'; import '/catalogue/categories_bottom_sheet/categories_bottom_sheet_widget.dart'; import '/components/product_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/home/see_all/see_all_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; import 'package:provider/provider.dart'; import 'home_model.dart'; export 'home_model.dart'; class HomeWidget extends StatefulWidget { const HomeWidget({Key? key}) : super(key: key); @override _HomeWidgetState createState() => _HomeWidgetState(); } class _HomeWidgetState extends State<HomeWidget> { late HomeModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => HomeModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Padding( padding: EdgeInsetsDirectional.fromSTEB(0.0, 88.0, 0.0, 0.0), child: Column( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 24.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ Expanded( child: Text( 'Catalogue', style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context).primary, fontSize: 19.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { _model.updatePage(() { FFAppState().pageNumber = 2; }); }, child: wrapWithModel( model: _model.seeAllModel, updateCallback: () => setState(() {}), child: SeeAllWidget(), ), ), ], ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB(0.0, 16.0, 0.0, 0.0), child: Container( width: double.infinity, height: 88.0, decoration: BoxDecoration(), child: FutureBuilder<List<CatalogueRecord>>( future: queryCatalogueRecordOnce( queryBuilder: (catalogueRecord) => catalogueRecord.orderBy('created_at'), ), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<CatalogueRecord> listViewCatalogueRecordList = snapshot.data!; return ListView.separated( padding: EdgeInsets.symmetric(horizontal: 16.0), scrollDirection: Axis.horizontal, itemCount: listViewCatalogueRecordList.length, separatorBuilder: (_, __) => SizedBox(width: 16.0), itemBuilder: (context, listViewIndex) { final listViewCatalogueRecord = listViewCatalogueRecordList[listViewIndex]; return ClipRRect( borderRadius: BorderRadius.circular(8.0), child: Container( width: 88.0, height: 88.0, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.cover, image: Image.network( listViewCatalogueRecord.imageUrl, ).image, ), borderRadius: BorderRadius.circular(8.0), ), child: Opacity( opacity: 0.8, child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { await showModalBottomSheet( isScrollControlled: true, backgroundColor: Colors.transparent, enableDrag: false, context: context, builder: (context) { return Padding( padding: MediaQuery.viewInsetsOf(context), child: Container( height: MediaQuery.sizeOf(context).height * 0.4, child: CategoriesBottomSheetWidget( title: listViewCatalogueRecord.title, catalogueId: listViewCatalogueRecord .reference.id, ), ), ); }, ).then((value) => safeSetState(() {})); }, child: Container( width: 88.0, height: 88.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).primary, Color(0x3334283E) ], stops: [0.0, 1.0], begin: AlignmentDirectional(-1.0, 0.0), end: AlignmentDirectional(1.0, 0), ), ), child: Align( alignment: AlignmentDirectional(0.0, 0.0), child: Text( listViewCatalogueRecord.title, textAlign: TextAlign.center, style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context) .secondaryBackground, fontWeight: FontWeight.w600, useGoogleFonts: false, ), ), ), ), ), ), ), ); }, ); }, ), ), ), Align( alignment: AlignmentDirectional(-1.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 32.0, 0.0, 0.0), child: Text( 'Featured', style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Text', color: FlutterFlowTheme.of(context).primary, fontSize: 19.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ), Flexible( child: Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 16.0, 16.0, 53.0), child: PagedGridView<DocumentSnapshot<Object?>?, ProductsRecord>( pagingController: _model.setGridViewController( ProductsRecord.collection .where( 'featured', isEqualTo: true, ) .orderBy('created_at', descending: true), ), padding: EdgeInsets.zero, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 17.0, mainAxisSpacing: 24.0, childAspectRatio: 0.6, ), primary: false, scrollDirection: Axis.vertical, builderDelegate: PagedChildBuilderDelegate<ProductsRecord>( // Customize what your widget looks like when it's loading the first page. firstPageProgressIndicatorBuilder: (_) => Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ), // Customize what your widget looks like when it's loading another page. newPageProgressIndicatorBuilder: (_) => Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ), itemBuilder: (context, _, gridViewIndex) { final gridViewProductsRecord = _model .gridViewPagingController!.itemList![gridViewIndex]; return ProductWidget( key: Key( 'Key0np_${gridViewIndex}_of_${_model.gridViewPagingController!.itemList!.length}'), discount: gridViewProductsRecord.discount, image: gridViewProductsRecord.imagesUrl.first, raiting: gridViewProductsRecord.raiting, title: gridViewProductsRecord.title, price: gridViewProductsRecord.price, discountPrice: gridViewProductsRecord.discountPrice, isFavorite: gridViewProductsRecord.inFavorites .contains(currentUserUid) == true, docRef: gridViewProductsRecord.reference, doc: gridViewProductsRecord, ); }, ), ), ), ), ], ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/home
mirrored_repositories/flutterflow_ecommerce_app/lib/home/home/home_model.dart
import '/auth/firebase_auth/auth_util.dart'; import '/backend/backend.dart'; import '/catalogue/categories_bottom_sheet/categories_bottom_sheet_widget.dart'; import '/components/product_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/home/see_all/see_all_widget.dart'; import 'home_widget.dart' show HomeWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; import 'package:provider/provider.dart'; class HomeModel extends FlutterFlowModel<HomeWidget> { /// State fields for stateful widgets in this component. // Model for SeeAll component. late SeeAllModel seeAllModel; // State field(s) for GridView widget. PagingController<DocumentSnapshot?, ProductsRecord>? gridViewPagingController; Query? gridViewPagingQuery; List<StreamSubscription?> gridViewStreamSubscriptions = []; /// Initialization and disposal methods. void initState(BuildContext context) { seeAllModel = createModel(context, () => SeeAllModel()); } void dispose() { seeAllModel.dispose(); gridViewStreamSubscriptions.forEach((s) => s?.cancel()); gridViewPagingController?.dispose(); } /// Action blocks are added here. /// Additional helper methods are added here. PagingController<DocumentSnapshot?, ProductsRecord> setGridViewController( Query query, { DocumentReference<Object?>? parent, }) { gridViewPagingController ??= _createGridViewController(query, parent); if (gridViewPagingQuery != query) { gridViewPagingQuery = query; gridViewPagingController?.refresh(); } return gridViewPagingController!; } PagingController<DocumentSnapshot?, ProductsRecord> _createGridViewController( Query query, DocumentReference<Object?>? parent, ) { final controller = PagingController<DocumentSnapshot?, ProductsRecord>(firstPageKey: null); return controller ..addPageRequestListener( (nextPageMarker) => queryProductsRecordPage( queryBuilder: (_) => gridViewPagingQuery ??= query, nextPageMarker: nextPageMarker, streamSubscriptions: gridViewStreamSubscriptions, controller: controller, pageSize: 4, isStream: true, ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/home
mirrored_repositories/flutterflow_ecommerce_app/lib/home/home_app_bar/home_app_bar_model.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'home_app_bar_widget.dart' show HomeAppBarWidget; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class HomeAppBarModel extends FlutterFlowModel<HomeAppBarWidget> { /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/home
mirrored_repositories/flutterflow_ecommerce_app/lib/home/home_app_bar/home_app_bar_widget.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'home_app_bar_model.dart'; export 'home_app_bar_model.dart'; class HomeAppBarWidget extends StatefulWidget { const HomeAppBarWidget({Key? key}) : super(key: key); @override _HomeAppBarWidgetState createState() => _HomeAppBarWidgetState(); } class _HomeAppBarWidgetState extends State<HomeAppBarWidget> { late HomeAppBarModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => HomeAppBarModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Container( width: double.infinity, height: 88.0, decoration: BoxDecoration(), child: Stack( children: [ Container( width: double.infinity, height: 66.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).primary, FlutterFlowTheme.of(context).secondary ], stops: [0.0, 1.0], begin: AlignmentDirectional(-1.0, 0.0), end: AlignmentDirectional(1.0, 0), ), ), ), Column( mainAxisSize: MainAxisSize.min, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/menu.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), Expanded( flex: 1, child: Align( alignment: AlignmentDirectional(0.0, 0.0), child: RichText( textScaleFactor: MediaQuery.of(context).textScaleFactor, text: TextSpan( children: [ TextSpan( text: 'My', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'Montserrat', color: FlutterFlowTheme.of(context).accent1, fontSize: 18.0, fontWeight: FontWeight.w800, ), ), TextSpan( text: 'Shop', style: GoogleFonts.getFont( 'Montserrat', color: FlutterFlowTheme.of(context) .secondaryBackground, fontWeight: FontWeight.w800, fontSize: 18.0, ), ) ], style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Display', letterSpacing: 2.0, useGoogleFonts: false, ), ), ), ), ), ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/bell.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), ], ), ), ], ), ], ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue/catalogue/catalogue_model.dart
import '/backend/backend.dart'; import '/catalogue/categories_bottom_sheet/categories_bottom_sheet_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'catalogue_widget.dart' show CatalogueWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class CatalogueModel extends FlutterFlowModel<CatalogueWidget> { /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue/catalogue/catalogue_widget.dart
import '/backend/backend.dart'; import '/catalogue/categories_bottom_sheet/categories_bottom_sheet_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'catalogue_model.dart'; export 'catalogue_model.dart'; class CatalogueWidget extends StatefulWidget { const CatalogueWidget({Key? key}) : super(key: key); @override _CatalogueWidgetState createState() => _CatalogueWidgetState(); } class _CatalogueWidgetState extends State<CatalogueWidget> { late CatalogueModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => CatalogueModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return FutureBuilder<List<CatalogueRecord>>( future: queryCatalogueRecordOnce( queryBuilder: (catalogueRecord) => catalogueRecord.orderBy('created_at'), ), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<CatalogueRecord> listViewCatalogueRecordList = snapshot.data!; return ListView.separated( padding: EdgeInsets.fromLTRB( 0, 104.0, 0, 98.0, ), scrollDirection: Axis.vertical, itemCount: listViewCatalogueRecordList.length, separatorBuilder: (_, __) => SizedBox(height: 16.0), itemBuilder: (context, listViewIndex) { final listViewCatalogueRecord = listViewCatalogueRecordList[listViewIndex]; return Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0), child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { await showModalBottomSheet( isScrollControlled: true, backgroundColor: Colors.transparent, enableDrag: false, context: context, builder: (context) { return Padding( padding: MediaQuery.viewInsetsOf(context), child: Container( height: MediaQuery.sizeOf(context).height * 0.4, child: CategoriesBottomSheetWidget( title: listViewCatalogueRecord.title, catalogueId: listViewCatalogueRecord.reference.id, ), ), ); }, ).then((value) => safeSetState(() {})); }, child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: Container( width: double.infinity, height: 88.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, borderRadius: BorderRadius.circular(8.0), ), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ Expanded( child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 8.0, 0.0), child: Text( listViewCatalogueRecord.title, style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Text', fontSize: 17.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ), Image.network( listViewCatalogueRecord.imageUrl, width: 88.0, height: double.infinity, fit: BoxFit.cover, ), ], ), ), ), ), ), ); }, ); }, ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue/catalogue_app_bar/catalogue_app_bar_widget.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'catalogue_app_bar_model.dart'; export 'catalogue_app_bar_model.dart'; class CatalogueAppBarWidget extends StatefulWidget { const CatalogueAppBarWidget({Key? key}) : super(key: key); @override _CatalogueAppBarWidgetState createState() => _CatalogueAppBarWidgetState(); } class _CatalogueAppBarWidgetState extends State<CatalogueAppBarWidget> { late CatalogueAppBarModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => CatalogueAppBarModel()); _model.textController ??= TextEditingController(); _model.textFieldFocusNode ??= FocusNode(); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Container( width: double.infinity, height: 88.0, decoration: BoxDecoration(), child: Stack( children: [ Container( width: double.infinity, height: 66.0, decoration: BoxDecoration( gradient: LinearGradient( colors: [ FlutterFlowTheme.of(context).primary, FlutterFlowTheme.of(context).secondary ], stops: [0.0, 1.0], begin: AlignmentDirectional(-1.0, 0.0), end: AlignmentDirectional(1.0, 0), ), ), ), Column( mainAxisSize: MainAxisSize.min, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, children: [ ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/back.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), Expanded( child: Align( alignment: AlignmentDirectional(0.0, 0.0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 0.0, 0.0, 24.0, 0.0), child: Text( 'Catalogue', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Display', color: FlutterFlowTheme.of(context) .secondaryBackground, fontSize: 19.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), ), ), ], ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB(20.0, 18.0, 20.0, 0.0), child: Container( width: double.infinity, height: 44.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, boxShadow: [ BoxShadow( blurRadius: 15.0, color: Color(0x0D000000), offset: Offset(0.0, 5.0), ) ], borderRadius: BorderRadius.circular(40.0), ), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( 'assets/images/search.svg', width: 24.0, height: 24.0, fit: BoxFit.scaleDown, ), ), Expanded( child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 8.0, 0.0, 0.0, 0.0), child: Container( width: 100.0, child: TextFormField( controller: _model.textController, focusNode: _model.textFieldFocusNode, obscureText: false, decoration: InputDecoration( hintText: 'What are you looking for?', hintStyle: FlutterFlowTheme.of(context) .labelMedium .override( fontFamily: 'SF Pro Display', color: FlutterFlowTheme.of(context) .primaryBackground, fontSize: 14.0, fontWeight: FontWeight.w600, useGoogleFonts: false, ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, errorBorder: InputBorder.none, focusedErrorBorder: InputBorder.none, ), style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'SF Pro Display', color: FlutterFlowTheme.of(context) .secondaryText, fontSize: 14.0, fontWeight: FontWeight.w600, useGoogleFonts: false, ), validator: _model.textControllerValidator .asValidator(context), ), ), ), ), ], ), ), ), ), ], ), ], ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue/catalogue_app_bar/catalogue_app_bar_model.dart
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'catalogue_app_bar_widget.dart' show CatalogueAppBarWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class CatalogueAppBarModel extends FlutterFlowModel<CatalogueAppBarWidget> { /// State fields for stateful widgets in this component. // State field(s) for TextField widget. FocusNode? textFieldFocusNode; TextEditingController? textController; String? Function(BuildContext, String?)? textControllerValidator; /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() { textFieldFocusNode?.dispose(); textController?.dispose(); } /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue/categories_bottom_sheet/categories_bottom_sheet_model.dart
import '/backend/backend.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'categories_bottom_sheet_widget.dart' show CategoriesBottomSheetWidget; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; class CategoriesBottomSheetModel extends FlutterFlowModel<CategoriesBottomSheetWidget> { /// Initialization and disposal methods. void initState(BuildContext context) {} void dispose() {} /// Action blocks are added here. /// Additional helper methods are added here. }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue
mirrored_repositories/flutterflow_ecommerce_app/lib/catalogue/categories_bottom_sheet/categories_bottom_sheet_widget.dart
import '/backend/backend.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'categories_bottom_sheet_model.dart'; export 'categories_bottom_sheet_model.dart'; class CategoriesBottomSheetWidget extends StatefulWidget { const CategoriesBottomSheetWidget({ Key? key, String? title, required this.catalogueId, }) : this.title = title ?? '', super(key: key); final String title; final String? catalogueId; @override _CategoriesBottomSheetWidgetState createState() => _CategoriesBottomSheetWidgetState(); } class _CategoriesBottomSheetWidgetState extends State<CategoriesBottomSheetWidget> { late CategoriesBottomSheetModel _model; @override void setState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); } @override void initState() { super.initState(); _model = createModel(context, () => CategoriesBottomSheetModel()); } @override void dispose() { _model.maybeDispose(); super.dispose(); } @override Widget build(BuildContext context) { context.watch<FFAppState>(); return Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).secondaryBackground, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(0.0), bottomRight: Radius.circular(0.0), topLeft: Radius.circular(24.0), topRight: Radius.circular(24.0), ), ), child: Column( mainAxisSize: MainAxisSize.max, children: [ Padding( padding: EdgeInsetsDirectional.fromSTEB(0.0, 12.0, 0.0, 0.0), child: Container( width: 60.0, height: 5.0, decoration: BoxDecoration( color: Color(0xFFE3E3E3), borderRadius: BorderRadius.circular(45.0), ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB(0.0, 16.0, 0.0, 0.0), child: Text( widget.title, style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Text', fontSize: 19.0, fontWeight: FontWeight.bold, useGoogleFonts: false, ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB(24.0, 12.0, 24.0, 0.0), child: FutureBuilder<List<CategoriesRecord>>( future: queryCategoriesRecordOnce( queryBuilder: (categoriesRecord) => categoriesRecord .where( 'catalogue_id', isEqualTo: widget.catalogueId, ) .orderBy('created_at'), ), builder: (context, snapshot) { // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( width: 50.0, height: 50.0, child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( FlutterFlowTheme.of(context).primary, ), ), ), ); } List<CategoriesRecord> listViewCategoriesRecordList = snapshot.data!; return ListView.separated( padding: EdgeInsets.zero, shrinkWrap: true, scrollDirection: Axis.vertical, itemCount: listViewCategoriesRecordList.length, separatorBuilder: (_, __) => SizedBox(height: 12.0), itemBuilder: (context, listViewIndex) { final listViewCategoriesRecord = listViewCategoriesRecordList[listViewIndex]; return InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { Navigator.pop( context, listViewCategoriesRecord.reference.id); context.pushNamed( 'CategoryPage', queryParameters: { 'title': serializeParam( listViewCategoriesRecord.title, ParamType.String, ), 'category': serializeParam( listViewCategoriesRecord, ParamType.Document, ), }.withoutNulls, extra: <String, dynamic>{ 'category': listViewCategoriesRecord, }, ); }, child: Text( listViewCategoriesRecord.title, style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'SF Pro Display', color: FlutterFlowTheme.of(context).secondaryText, useGoogleFonts: false, ), ), ); }, ); }, ), ), ], ), ); } }
0
mirrored_repositories/flutterflow_ecommerce_app/lib
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/backend.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import '../auth/firebase_auth/auth_util.dart'; import '../flutter_flow/flutter_flow_util.dart'; import 'schema/util/firestore_util.dart'; import 'schema/users_record.dart'; import 'schema/catalogue_record.dart'; import 'schema/products_record.dart'; import 'schema/categories_record.dart'; import 'schema/product_type_record.dart'; import 'schema/brands_record.dart'; import 'schema/colors_record.dart'; import 'schema/sizes_record.dart'; import 'schema/reviews_record.dart'; import 'schema/cart_record.dart'; import 'schema/cart_content_record.dart'; import 'dart:async'; import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; export 'dart:async' show StreamSubscription; export 'package:cloud_firestore/cloud_firestore.dart'; export 'schema/index.dart'; export 'schema/util/firestore_util.dart'; export 'schema/util/schema_util.dart'; export 'schema/users_record.dart'; export 'schema/catalogue_record.dart'; export 'schema/products_record.dart'; export 'schema/categories_record.dart'; export 'schema/product_type_record.dart'; export 'schema/brands_record.dart'; export 'schema/colors_record.dart'; export 'schema/sizes_record.dart'; export 'schema/reviews_record.dart'; export 'schema/cart_record.dart'; export 'schema/cart_content_record.dart'; /// Functions to query UsersRecords (as a Stream and as a Future). Future<int> queryUsersRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( UsersRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<UsersRecord>> queryUsersRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( UsersRecord.collection, UsersRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<UsersRecord>> queryUsersRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( UsersRecord.collection, UsersRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<UsersRecord>> queryUsersRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, UsersRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( UsersRecord.collection, UsersRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<UsersRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query CatalogueRecords (as a Stream and as a Future). Future<int> queryCatalogueRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( CatalogueRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<CatalogueRecord>> queryCatalogueRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( CatalogueRecord.collection, CatalogueRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<CatalogueRecord>> queryCatalogueRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( CatalogueRecord.collection, CatalogueRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<CatalogueRecord>> queryCatalogueRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, CatalogueRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( CatalogueRecord.collection, CatalogueRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<CatalogueRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query ProductsRecords (as a Stream and as a Future). Future<int> queryProductsRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( ProductsRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<ProductsRecord>> queryProductsRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( ProductsRecord.collection, ProductsRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<ProductsRecord>> queryProductsRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( ProductsRecord.collection, ProductsRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<ProductsRecord>> queryProductsRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, ProductsRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( ProductsRecord.collection, ProductsRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<ProductsRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query CategoriesRecords (as a Stream and as a Future). Future<int> queryCategoriesRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( CategoriesRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<CategoriesRecord>> queryCategoriesRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( CategoriesRecord.collection, CategoriesRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<CategoriesRecord>> queryCategoriesRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( CategoriesRecord.collection, CategoriesRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<CategoriesRecord>> queryCategoriesRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, CategoriesRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( CategoriesRecord.collection, CategoriesRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<CategoriesRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query ProductTypeRecords (as a Stream and as a Future). Future<int> queryProductTypeRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( ProductTypeRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<ProductTypeRecord>> queryProductTypeRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( ProductTypeRecord.collection, ProductTypeRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<ProductTypeRecord>> queryProductTypeRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( ProductTypeRecord.collection, ProductTypeRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<ProductTypeRecord>> queryProductTypeRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, ProductTypeRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( ProductTypeRecord.collection, ProductTypeRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<ProductTypeRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query BrandsRecords (as a Stream and as a Future). Future<int> queryBrandsRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( BrandsRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<BrandsRecord>> queryBrandsRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( BrandsRecord.collection, BrandsRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<BrandsRecord>> queryBrandsRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( BrandsRecord.collection, BrandsRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<BrandsRecord>> queryBrandsRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, BrandsRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( BrandsRecord.collection, BrandsRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<BrandsRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query ColorsRecords (as a Stream and as a Future). Future<int> queryColorsRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( ColorsRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<ColorsRecord>> queryColorsRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( ColorsRecord.collection, ColorsRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<ColorsRecord>> queryColorsRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( ColorsRecord.collection, ColorsRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<ColorsRecord>> queryColorsRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, ColorsRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( ColorsRecord.collection, ColorsRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<ColorsRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query SizesRecords (as a Stream and as a Future). Future<int> querySizesRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( SizesRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<SizesRecord>> querySizesRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( SizesRecord.collection, SizesRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<SizesRecord>> querySizesRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( SizesRecord.collection, SizesRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<SizesRecord>> querySizesRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, SizesRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( SizesRecord.collection, SizesRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<SizesRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query ReviewsRecords (as a Stream and as a Future). Future<int> queryReviewsRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( ReviewsRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<ReviewsRecord>> queryReviewsRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( ReviewsRecord.collection, ReviewsRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<ReviewsRecord>> queryReviewsRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( ReviewsRecord.collection, ReviewsRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<ReviewsRecord>> queryReviewsRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, ReviewsRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( ReviewsRecord.collection, ReviewsRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<ReviewsRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query CartRecords (as a Stream and as a Future). Future<int> queryCartRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( CartRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<CartRecord>> queryCartRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( CartRecord.collection, CartRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<CartRecord>> queryCartRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( CartRecord.collection, CartRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<CartRecord>> queryCartRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, CartRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( CartRecord.collection, CartRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<CartRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); /// Functions to query CartContentRecords (as a Stream and as a Future). Future<int> queryCartContentRecordCount({ Query Function(Query)? queryBuilder, int limit = -1, }) => queryCollectionCount( CartContentRecord.collection, queryBuilder: queryBuilder, limit: limit, ); Stream<List<CartContentRecord>> queryCartContentRecord({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollection( CartContentRecord.collection, CartContentRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<List<CartContentRecord>> queryCartContentRecordOnce({ Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) => queryCollectionOnce( CartContentRecord.collection, CartContentRecord.fromSnapshot, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, ); Future<FFFirestorePage<CartContentRecord>> queryCartContentRecordPage({ Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, required PagingController<DocumentSnapshot?, CartContentRecord> controller, List<StreamSubscription?>? streamSubscriptions, }) => queryCollectionPage( CartContentRecord.collection, CartContentRecord.fromSnapshot, queryBuilder: queryBuilder, nextPageMarker: nextPageMarker, pageSize: pageSize, isStream: isStream, ).then((page) { controller.appendPage( page.data, page.nextPageMarker, ); if (isStream) { final streamSubscription = (page.dataStream)?.listen((List<CartContentRecord> data) { data.forEach((item) { final itemIndexes = controller.itemList! .asMap() .map((k, v) => MapEntry(v.reference.id, k)); final index = itemIndexes[item.reference.id]; final items = controller.itemList!; if (index != null) { items.replaceRange(index, index + 1, [item]); controller.itemList = { for (var item in items) item.reference: item }.values.toList(); } }); }); streamSubscriptions?.add(streamSubscription); } return page; }); Future<int> queryCollectionCount( Query collection, { Query Function(Query)? queryBuilder, int limit = -1, }) { final builder = queryBuilder ?? (q) => q; var query = builder(collection); if (limit > 0) { query = query.limit(limit); } return query.count().get().catchError((err) { print('Error querying $collection: $err'); }).then((value) => value.count); } Stream<List<T>> queryCollection<T>( Query collection, RecordBuilder<T> recordBuilder, { Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) { final builder = queryBuilder ?? (q) => q; var query = builder(collection); if (limit > 0 || singleRecord) { query = query.limit(singleRecord ? 1 : limit); } return query.snapshots().handleError((err) { print('Error querying $collection: $err'); }).map((s) => s.docs .map( (d) => safeGet( () => recordBuilder(d), (e) => print('Error serializing doc ${d.reference.path}:\n$e'), ), ) .where((d) => d != null) .map((d) => d!) .toList()); } Future<List<T>> queryCollectionOnce<T>( Query collection, RecordBuilder<T> recordBuilder, { Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, }) { final builder = queryBuilder ?? (q) => q; var query = builder(collection); if (limit > 0 || singleRecord) { query = query.limit(singleRecord ? 1 : limit); } return query.get().then((s) => s.docs .map( (d) => safeGet( () => recordBuilder(d), (e) => print('Error serializing doc ${d.reference.path}:\n$e'), ), ) .where((d) => d != null) .map((d) => d!) .toList()); } extension QueryExtension on Query { Query whereIn(String field, List? list) => (list?.isEmpty ?? true) ? where(field, whereIn: null) : where(field, whereIn: list); Query whereNotIn(String field, List? list) => (list?.isEmpty ?? true) ? where(field, whereNotIn: null) : where(field, whereNotIn: list); Query whereArrayContainsAny(String field, List? list) => (list?.isEmpty ?? true) ? where(field, arrayContainsAny: null) : where(field, arrayContainsAny: list); } class FFFirestorePage<T> { final List<T> data; final Stream<List<T>>? dataStream; final QueryDocumentSnapshot? nextPageMarker; FFFirestorePage(this.data, this.dataStream, this.nextPageMarker); } Future<FFFirestorePage<T>> queryCollectionPage<T>( Query collection, RecordBuilder<T> recordBuilder, { Query Function(Query)? queryBuilder, DocumentSnapshot? nextPageMarker, required int pageSize, required bool isStream, }) async { final builder = queryBuilder ?? (q) => q; var query = builder(collection).limit(pageSize); if (nextPageMarker != null) { query = query.startAfterDocument(nextPageMarker); } Stream<QuerySnapshot>? docSnapshotStream; QuerySnapshot docSnapshot; if (isStream) { docSnapshotStream = query.snapshots(); docSnapshot = await docSnapshotStream.first; } else { docSnapshot = await query.get(); } final getDocs = (QuerySnapshot s) => s.docs .map( (d) => safeGet( () => recordBuilder(d), (e) => print('Error serializing doc ${d.reference.path}:\n$e'), ), ) .where((d) => d != null) .map((d) => d!) .toList(); final data = getDocs(docSnapshot); final dataStream = docSnapshotStream?.map(getDocs); final nextPageToken = docSnapshot.docs.isEmpty ? null : docSnapshot.docs.last; return FFFirestorePage(data, dataStream, nextPageToken); } // Creates a Firestore document representing the logged in user if it doesn't yet exist Future maybeCreateUser(User user) async { final userRecord = UsersRecord.collection.doc(user.uid); final userExists = await userRecord.get().then((u) => u.exists); if (userExists) { currentUserDocument = await UsersRecord.getDocumentOnce(userRecord); return; } final userData = createUsersRecordData( email: user.email ?? FirebaseAuth.instance.currentUser?.email ?? user.providerData.firstOrNull?.email, displayName: user.displayName ?? FirebaseAuth.instance.currentUser?.displayName, photoUrl: user.photoURL, uid: user.uid, phoneNumber: user.phoneNumber, createdTime: getCurrentTimestamp, ); await userRecord.set(userData); currentUserDocument = UsersRecord.getDocumentFromData(userData, userRecord); } Future updateUserDocument({String? email}) async { await currentUserDocument?.reference .update(createUsersRecordData(email: email)); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/catalogue_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class CatalogueRecord extends FirestoreRecord { CatalogueRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "title" field. String? _title; String get title => _title ?? ''; bool hasTitle() => _title != null; // "image_url" field. String? _imageUrl; String get imageUrl => _imageUrl ?? ''; bool hasImageUrl() => _imageUrl != null; // "created_at" field. DateTime? _createdAt; DateTime? get createdAt => _createdAt; bool hasCreatedAt() => _createdAt != null; void _initializeFields() { _title = snapshotData['title'] as String?; _imageUrl = snapshotData['image_url'] as String?; _createdAt = snapshotData['created_at'] as DateTime?; } static CollectionReference get collection => FirebaseFirestore.instance.collection('catalogue'); static Stream<CatalogueRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => CatalogueRecord.fromSnapshot(s)); static Future<CatalogueRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => CatalogueRecord.fromSnapshot(s)); static CatalogueRecord fromSnapshot(DocumentSnapshot snapshot) => CatalogueRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static CatalogueRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => CatalogueRecord._(reference, mapFromFirestore(data)); @override String toString() => 'CatalogueRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is CatalogueRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createCatalogueRecordData({ String? title, String? imageUrl, DateTime? createdAt, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'title': title, 'image_url': imageUrl, 'created_at': createdAt, }.withoutNulls, ); return firestoreData; } class CatalogueRecordDocumentEquality implements Equality<CatalogueRecord> { const CatalogueRecordDocumentEquality(); @override bool equals(CatalogueRecord? e1, CatalogueRecord? e2) { return e1?.title == e2?.title && e1?.imageUrl == e2?.imageUrl && e1?.createdAt == e2?.createdAt; } @override int hash(CatalogueRecord? e) => const ListEquality().hash([e?.title, e?.imageUrl, e?.createdAt]); @override bool isValidKey(Object? o) => o is CatalogueRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/reviews_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class ReviewsRecord extends FirestoreRecord { ReviewsRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "user_name" field. String? _userName; String get userName => _userName ?? ''; bool hasUserName() => _userName != null; // "rating" field. double? _rating; double get rating => _rating ?? 0.0; bool hasRating() => _rating != null; // "text" field. String? _text; String get text => _text ?? ''; bool hasText() => _text != null; // "date" field. DateTime? _date; DateTime? get date => _date; bool hasDate() => _date != null; // "found_helpful_count" field. int? _foundHelpfulCount; int get foundHelpfulCount => _foundHelpfulCount ?? 0; bool hasFoundHelpfulCount() => _foundHelpfulCount != null; // "is_helpfull" field. bool? _isHelpfull; bool get isHelpfull => _isHelpfull ?? false; bool hasIsHelpfull() => _isHelpfull != null; void _initializeFields() { _userName = snapshotData['user_name'] as String?; _rating = castToType<double>(snapshotData['rating']); _text = snapshotData['text'] as String?; _date = snapshotData['date'] as DateTime?; _foundHelpfulCount = castToType<int>(snapshotData['found_helpful_count']); _isHelpfull = snapshotData['is_helpfull'] as bool?; } static CollectionReference get collection => FirebaseFirestore.instance.collection('reviews'); static Stream<ReviewsRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => ReviewsRecord.fromSnapshot(s)); static Future<ReviewsRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => ReviewsRecord.fromSnapshot(s)); static ReviewsRecord fromSnapshot(DocumentSnapshot snapshot) => ReviewsRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static ReviewsRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => ReviewsRecord._(reference, mapFromFirestore(data)); @override String toString() => 'ReviewsRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is ReviewsRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createReviewsRecordData({ String? userName, double? rating, String? text, DateTime? date, int? foundHelpfulCount, bool? isHelpfull, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'user_name': userName, 'rating': rating, 'text': text, 'date': date, 'found_helpful_count': foundHelpfulCount, 'is_helpfull': isHelpfull, }.withoutNulls, ); return firestoreData; } class ReviewsRecordDocumentEquality implements Equality<ReviewsRecord> { const ReviewsRecordDocumentEquality(); @override bool equals(ReviewsRecord? e1, ReviewsRecord? e2) { return e1?.userName == e2?.userName && e1?.rating == e2?.rating && e1?.text == e2?.text && e1?.date == e2?.date && e1?.foundHelpfulCount == e2?.foundHelpfulCount && e1?.isHelpfull == e2?.isHelpfull; } @override int hash(ReviewsRecord? e) => const ListEquality().hash([ e?.userName, e?.rating, e?.text, e?.date, e?.foundHelpfulCount, e?.isHelpfull ]); @override bool isValidKey(Object? o) => o is ReviewsRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/brands_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class BrandsRecord extends FirestoreRecord { BrandsRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "name" field. String? _name; String get name => _name ?? ''; bool hasName() => _name != null; void _initializeFields() { _name = snapshotData['name'] as String?; } static CollectionReference get collection => FirebaseFirestore.instance.collection('brands'); static Stream<BrandsRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => BrandsRecord.fromSnapshot(s)); static Future<BrandsRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => BrandsRecord.fromSnapshot(s)); static BrandsRecord fromSnapshot(DocumentSnapshot snapshot) => BrandsRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static BrandsRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => BrandsRecord._(reference, mapFromFirestore(data)); @override String toString() => 'BrandsRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is BrandsRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createBrandsRecordData({ String? name, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'name': name, }.withoutNulls, ); return firestoreData; } class BrandsRecordDocumentEquality implements Equality<BrandsRecord> { const BrandsRecordDocumentEquality(); @override bool equals(BrandsRecord? e1, BrandsRecord? e2) { return e1?.name == e2?.name; } @override int hash(BrandsRecord? e) => const ListEquality().hash([e?.name]); @override bool isValidKey(Object? o) => o is BrandsRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/colors_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class ColorsRecord extends FirestoreRecord { ColorsRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "color" field. Color? _color; Color? get color => _color; bool hasColor() => _color != null; void _initializeFields() { _color = getSchemaColor(snapshotData['color']); } static CollectionReference get collection => FirebaseFirestore.instance.collection('colors'); static Stream<ColorsRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => ColorsRecord.fromSnapshot(s)); static Future<ColorsRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => ColorsRecord.fromSnapshot(s)); static ColorsRecord fromSnapshot(DocumentSnapshot snapshot) => ColorsRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static ColorsRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => ColorsRecord._(reference, mapFromFirestore(data)); @override String toString() => 'ColorsRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is ColorsRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createColorsRecordData({ Color? color, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'color': color, }.withoutNulls, ); return firestoreData; } class ColorsRecordDocumentEquality implements Equality<ColorsRecord> { const ColorsRecordDocumentEquality(); @override bool equals(ColorsRecord? e1, ColorsRecord? e2) { return e1?.color == e2?.color; } @override int hash(ColorsRecord? e) => const ListEquality().hash([e?.color]); @override bool isValidKey(Object? o) => o is ColorsRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/categories_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class CategoriesRecord extends FirestoreRecord { CategoriesRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "title" field. String? _title; String get title => _title ?? ''; bool hasTitle() => _title != null; // "created_at" field. DateTime? _createdAt; DateTime? get createdAt => _createdAt; bool hasCreatedAt() => _createdAt != null; // "catalogue_id" field. String? _catalogueId; String get catalogueId => _catalogueId ?? ''; bool hasCatalogueId() => _catalogueId != null; // "product_types" field. List<String>? _productTypes; List<String> get productTypes => _productTypes ?? const []; bool hasProductTypes() => _productTypes != null; void _initializeFields() { _title = snapshotData['title'] as String?; _createdAt = snapshotData['created_at'] as DateTime?; _catalogueId = snapshotData['catalogue_id'] as String?; _productTypes = getDataList(snapshotData['product_types']); } static CollectionReference get collection => FirebaseFirestore.instance.collection('categories'); static Stream<CategoriesRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => CategoriesRecord.fromSnapshot(s)); static Future<CategoriesRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => CategoriesRecord.fromSnapshot(s)); static CategoriesRecord fromSnapshot(DocumentSnapshot snapshot) => CategoriesRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static CategoriesRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => CategoriesRecord._(reference, mapFromFirestore(data)); @override String toString() => 'CategoriesRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is CategoriesRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createCategoriesRecordData({ String? title, DateTime? createdAt, String? catalogueId, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'title': title, 'created_at': createdAt, 'catalogue_id': catalogueId, }.withoutNulls, ); return firestoreData; } class CategoriesRecordDocumentEquality implements Equality<CategoriesRecord> { const CategoriesRecordDocumentEquality(); @override bool equals(CategoriesRecord? e1, CategoriesRecord? e2) { const listEquality = ListEquality(); return e1?.title == e2?.title && e1?.createdAt == e2?.createdAt && e1?.catalogueId == e2?.catalogueId && listEquality.equals(e1?.productTypes, e2?.productTypes); } @override int hash(CategoriesRecord? e) => const ListEquality() .hash([e?.title, e?.createdAt, e?.catalogueId, e?.productTypes]); @override bool isValidKey(Object? o) => o is CategoriesRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/cart_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class CartRecord extends FirestoreRecord { CartRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "user_id" field. String? _userId; String get userId => _userId ?? ''; bool hasUserId() => _userId != null; // "price" field. double? _price; double get price => _price ?? 0.0; bool hasPrice() => _price != null; // "content" field. List<DocumentReference>? _content; List<DocumentReference> get content => _content ?? const []; bool hasContent() => _content != null; void _initializeFields() { _userId = snapshotData['user_id'] as String?; _price = castToType<double>(snapshotData['price']); _content = getDataList(snapshotData['content']); } static CollectionReference get collection => FirebaseFirestore.instance.collection('cart'); static Stream<CartRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => CartRecord.fromSnapshot(s)); static Future<CartRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => CartRecord.fromSnapshot(s)); static CartRecord fromSnapshot(DocumentSnapshot snapshot) => CartRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static CartRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => CartRecord._(reference, mapFromFirestore(data)); @override String toString() => 'CartRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is CartRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createCartRecordData({ String? userId, double? price, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'user_id': userId, 'price': price, }.withoutNulls, ); return firestoreData; } class CartRecordDocumentEquality implements Equality<CartRecord> { const CartRecordDocumentEquality(); @override bool equals(CartRecord? e1, CartRecord? e2) { const listEquality = ListEquality(); return e1?.userId == e2?.userId && e1?.price == e2?.price && listEquality.equals(e1?.content, e2?.content); } @override int hash(CartRecord? e) => const ListEquality().hash([e?.userId, e?.price, e?.content]); @override bool isValidKey(Object? o) => o is CartRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/index.dart
export 'package:cloud_firestore/cloud_firestore.dart'; export 'package:flutter/material.dart' show Color, Colors; export '/flutter_flow/lat_lng.dart';
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/users_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class UsersRecord extends FirestoreRecord { UsersRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "email" field. String? _email; String get email => _email ?? ''; bool hasEmail() => _email != null; // "display_name" field. String? _displayName; String get displayName => _displayName ?? ''; bool hasDisplayName() => _displayName != null; // "photo_url" field. String? _photoUrl; String get photoUrl => _photoUrl ?? ''; bool hasPhotoUrl() => _photoUrl != null; // "uid" field. String? _uid; String get uid => _uid ?? ''; bool hasUid() => _uid != null; // "created_time" field. DateTime? _createdTime; DateTime? get createdTime => _createdTime; bool hasCreatedTime() => _createdTime != null; // "phone_number" field. String? _phoneNumber; String get phoneNumber => _phoneNumber ?? ''; bool hasPhoneNumber() => _phoneNumber != null; void _initializeFields() { _email = snapshotData['email'] as String?; _displayName = snapshotData['display_name'] as String?; _photoUrl = snapshotData['photo_url'] as String?; _uid = snapshotData['uid'] as String?; _createdTime = snapshotData['created_time'] as DateTime?; _phoneNumber = snapshotData['phone_number'] as String?; } static CollectionReference get collection => FirebaseFirestore.instance.collection('users'); static Stream<UsersRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => UsersRecord.fromSnapshot(s)); static Future<UsersRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => UsersRecord.fromSnapshot(s)); static UsersRecord fromSnapshot(DocumentSnapshot snapshot) => UsersRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static UsersRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => UsersRecord._(reference, mapFromFirestore(data)); @override String toString() => 'UsersRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is UsersRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createUsersRecordData({ String? email, String? displayName, String? photoUrl, String? uid, DateTime? createdTime, String? phoneNumber, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'email': email, 'display_name': displayName, 'photo_url': photoUrl, 'uid': uid, 'created_time': createdTime, 'phone_number': phoneNumber, }.withoutNulls, ); return firestoreData; } class UsersRecordDocumentEquality implements Equality<UsersRecord> { const UsersRecordDocumentEquality(); @override bool equals(UsersRecord? e1, UsersRecord? e2) { return e1?.email == e2?.email && e1?.displayName == e2?.displayName && e1?.photoUrl == e2?.photoUrl && e1?.uid == e2?.uid && e1?.createdTime == e2?.createdTime && e1?.phoneNumber == e2?.phoneNumber; } @override int hash(UsersRecord? e) => const ListEquality().hash([ e?.email, e?.displayName, e?.photoUrl, e?.uid, e?.createdTime, e?.phoneNumber ]); @override bool isValidKey(Object? o) => o is UsersRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/sizes_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class SizesRecord extends FirestoreRecord { SizesRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "size" field. String? _size; String get size => _size ?? ''; bool hasSize() => _size != null; void _initializeFields() { _size = snapshotData['size'] as String?; } static CollectionReference get collection => FirebaseFirestore.instance.collection('sizes'); static Stream<SizesRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => SizesRecord.fromSnapshot(s)); static Future<SizesRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => SizesRecord.fromSnapshot(s)); static SizesRecord fromSnapshot(DocumentSnapshot snapshot) => SizesRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static SizesRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => SizesRecord._(reference, mapFromFirestore(data)); @override String toString() => 'SizesRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is SizesRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createSizesRecordData({ String? size, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'size': size, }.withoutNulls, ); return firestoreData; } class SizesRecordDocumentEquality implements Equality<SizesRecord> { const SizesRecordDocumentEquality(); @override bool equals(SizesRecord? e1, SizesRecord? e2) { return e1?.size == e2?.size; } @override int hash(SizesRecord? e) => const ListEquality().hash([e?.size]); @override bool isValidKey(Object? o) => o is SizesRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/products_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class ProductsRecord extends FirestoreRecord { ProductsRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "title" field. String? _title; String get title => _title ?? ''; bool hasTitle() => _title != null; // "price" field. double? _price; double get price => _price ?? 0.0; bool hasPrice() => _price != null; // "discount_price" field. double? _discountPrice; double get discountPrice => _discountPrice ?? 0.0; bool hasDiscountPrice() => _discountPrice != null; // "discount" field. int? _discount; int get discount => _discount ?? 0; bool hasDiscount() => _discount != null; // "raiting" field. int? _raiting; int get raiting => _raiting ?? 0; bool hasRaiting() => _raiting != null; // "featured" field. bool? _featured; bool get featured => _featured ?? false; bool hasFeatured() => _featured != null; // "images_url" field. List<String>? _imagesUrl; List<String> get imagesUrl => _imagesUrl ?? const []; bool hasImagesUrl() => _imagesUrl != null; // "created_at" field. DateTime? _createdAt; DateTime? get createdAt => _createdAt; bool hasCreatedAt() => _createdAt != null; // "in_favorites" field. List<String>? _inFavorites; List<String> get inFavorites => _inFavorites ?? const []; bool hasInFavorites() => _inFavorites != null; // "type" field. String? _type; String get type => _type ?? ''; bool hasType() => _type != null; // "brand" field. String? _brand; String get brand => _brand ?? ''; bool hasBrand() => _brand != null; // "sizes" field. List<String>? _sizes; List<String> get sizes => _sizes ?? const []; bool hasSizes() => _sizes != null; // "colors" field. List<String>? _colors; List<String> get colors => _colors ?? const []; bool hasColors() => _colors != null; // "in_stock" field. bool? _inStock; bool get inStock => _inStock ?? false; bool hasInStock() => _inStock != null; // "color_images" field. List<String>? _colorImages; List<String> get colorImages => _colorImages ?? const []; bool hasColorImages() => _colorImages != null; void _initializeFields() { _title = snapshotData['title'] as String?; _price = castToType<double>(snapshotData['price']); _discountPrice = castToType<double>(snapshotData['discount_price']); _discount = castToType<int>(snapshotData['discount']); _raiting = castToType<int>(snapshotData['raiting']); _featured = snapshotData['featured'] as bool?; _imagesUrl = getDataList(snapshotData['images_url']); _createdAt = snapshotData['created_at'] as DateTime?; _inFavorites = getDataList(snapshotData['in_favorites']); _type = snapshotData['type'] as String?; _brand = snapshotData['brand'] as String?; _sizes = getDataList(snapshotData['sizes']); _colors = getDataList(snapshotData['colors']); _inStock = snapshotData['in_stock'] as bool?; _colorImages = getDataList(snapshotData['color_images']); } static CollectionReference get collection => FirebaseFirestore.instance.collection('products'); static Stream<ProductsRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => ProductsRecord.fromSnapshot(s)); static Future<ProductsRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => ProductsRecord.fromSnapshot(s)); static ProductsRecord fromSnapshot(DocumentSnapshot snapshot) => ProductsRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static ProductsRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => ProductsRecord._(reference, mapFromFirestore(data)); @override String toString() => 'ProductsRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is ProductsRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createProductsRecordData({ String? title, double? price, double? discountPrice, int? discount, int? raiting, bool? featured, DateTime? createdAt, String? type, String? brand, bool? inStock, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'title': title, 'price': price, 'discount_price': discountPrice, 'discount': discount, 'raiting': raiting, 'featured': featured, 'created_at': createdAt, 'type': type, 'brand': brand, 'in_stock': inStock, }.withoutNulls, ); return firestoreData; } class ProductsRecordDocumentEquality implements Equality<ProductsRecord> { const ProductsRecordDocumentEquality(); @override bool equals(ProductsRecord? e1, ProductsRecord? e2) { const listEquality = ListEquality(); return e1?.title == e2?.title && e1?.price == e2?.price && e1?.discountPrice == e2?.discountPrice && e1?.discount == e2?.discount && e1?.raiting == e2?.raiting && e1?.featured == e2?.featured && listEquality.equals(e1?.imagesUrl, e2?.imagesUrl) && e1?.createdAt == e2?.createdAt && listEquality.equals(e1?.inFavorites, e2?.inFavorites) && e1?.type == e2?.type && e1?.brand == e2?.brand && listEquality.equals(e1?.sizes, e2?.sizes) && listEquality.equals(e1?.colors, e2?.colors) && e1?.inStock == e2?.inStock && listEquality.equals(e1?.colorImages, e2?.colorImages); } @override int hash(ProductsRecord? e) => const ListEquality().hash([ e?.title, e?.price, e?.discountPrice, e?.discount, e?.raiting, e?.featured, e?.imagesUrl, e?.createdAt, e?.inFavorites, e?.type, e?.brand, e?.sizes, e?.colors, e?.inStock, e?.colorImages ]); @override bool isValidKey(Object? o) => o is ProductsRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/product_type_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class ProductTypeRecord extends FirestoreRecord { ProductTypeRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "name" field. String? _name; String get name => _name ?? ''; bool hasName() => _name != null; void _initializeFields() { _name = snapshotData['name'] as String?; } static CollectionReference get collection => FirebaseFirestore.instance.collection('product_type'); static Stream<ProductTypeRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => ProductTypeRecord.fromSnapshot(s)); static Future<ProductTypeRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => ProductTypeRecord.fromSnapshot(s)); static ProductTypeRecord fromSnapshot(DocumentSnapshot snapshot) => ProductTypeRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static ProductTypeRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => ProductTypeRecord._(reference, mapFromFirestore(data)); @override String toString() => 'ProductTypeRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is ProductTypeRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createProductTypeRecordData({ String? name, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'name': name, }.withoutNulls, ); return firestoreData; } class ProductTypeRecordDocumentEquality implements Equality<ProductTypeRecord> { const ProductTypeRecordDocumentEquality(); @override bool equals(ProductTypeRecord? e1, ProductTypeRecord? e2) { return e1?.name == e2?.name; } @override int hash(ProductTypeRecord? e) => const ListEquality().hash([e?.name]); @override bool isValidKey(Object? o) => o is ProductTypeRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/cart_content_record.dart
import 'dart:async'; import 'package:collection/collection.dart'; import '/backend/schema/util/firestore_util.dart'; import '/backend/schema/util/schema_util.dart'; import 'index.dart'; import '/flutter_flow/flutter_flow_util.dart'; class CartContentRecord extends FirestoreRecord { CartContentRecord._( DocumentReference reference, Map<String, dynamic> data, ) : super(reference, data) { _initializeFields(); } // "cart_id" field. String? _cartId; String get cartId => _cartId ?? ''; bool hasCartId() => _cartId != null; // "price" field. double? _price; double get price => _price ?? 0.0; bool hasPrice() => _price != null; // "image" field. String? _image; String get image => _image ?? ''; bool hasImage() => _image != null; // "ammount" field. int? _ammount; int get ammount => _ammount ?? 0; bool hasAmmount() => _ammount != null; // "text" field. String? _text; String get text => _text ?? ''; bool hasText() => _text != null; void _initializeFields() { _cartId = snapshotData['cart_id'] as String?; _price = castToType<double>(snapshotData['price']); _image = snapshotData['image'] as String?; _ammount = castToType<int>(snapshotData['ammount']); _text = snapshotData['text'] as String?; } static CollectionReference get collection => FirebaseFirestore.instance.collection('cart_content'); static Stream<CartContentRecord> getDocument(DocumentReference ref) => ref.snapshots().map((s) => CartContentRecord.fromSnapshot(s)); static Future<CartContentRecord> getDocumentOnce(DocumentReference ref) => ref.get().then((s) => CartContentRecord.fromSnapshot(s)); static CartContentRecord fromSnapshot(DocumentSnapshot snapshot) => CartContentRecord._( snapshot.reference, mapFromFirestore(snapshot.data() as Map<String, dynamic>), ); static CartContentRecord getDocumentFromData( Map<String, dynamic> data, DocumentReference reference, ) => CartContentRecord._(reference, mapFromFirestore(data)); @override String toString() => 'CartContentRecord(reference: ${reference.path}, data: $snapshotData)'; @override int get hashCode => reference.path.hashCode; @override bool operator ==(other) => other is CartContentRecord && reference.path.hashCode == other.reference.path.hashCode; } Map<String, dynamic> createCartContentRecordData({ String? cartId, double? price, String? image, int? ammount, String? text, }) { final firestoreData = mapToFirestore( <String, dynamic>{ 'cart_id': cartId, 'price': price, 'image': image, 'ammount': ammount, 'text': text, }.withoutNulls, ); return firestoreData; } class CartContentRecordDocumentEquality implements Equality<CartContentRecord> { const CartContentRecordDocumentEquality(); @override bool equals(CartContentRecord? e1, CartContentRecord? e2) { return e1?.cartId == e2?.cartId && e1?.price == e2?.price && e1?.image == e2?.image && e1?.ammount == e2?.ammount && e1?.text == e2?.text; } @override int hash(CartContentRecord? e) => const ListEquality() .hash([e?.cartId, e?.price, e?.image, e?.ammount, e?.text]); @override bool isValidKey(Object? o) => o is CartContentRecord; }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/util/schema_util.dart
import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:from_css_color/from_css_color.dart'; import '/flutter_flow/flutter_flow_util.dart'; export 'package:collection/collection.dart' show ListEquality; export 'package:flutter/material.dart' show Color, Colors; export 'package:from_css_color/from_css_color.dart'; typedef StructBuilder<T> = T Function(Map<String, dynamic> data); abstract class BaseStruct { Map<String, dynamic> toSerializableMap(); String serialize() => json.encode(toSerializableMap()); } List<T>? getStructList<T>( dynamic value, StructBuilder<T> structBuilder, ) => value is! List ? null : value .where((e) => e is Map<String, dynamic>) .map((e) => structBuilder(e as Map<String, dynamic>)) .toList(); Color? getSchemaColor(dynamic value) => value is String ? fromCssColor(value) : value is Color ? value : null; List<Color>? getColorsList(dynamic value) => value is! List ? null : value.map(getSchemaColor).withoutNulls; List<T>? getDataList<T>(dynamic value) => value is! List ? null : value.map((e) => castToType<T>(e)!).toList(); extension MapDataExtensions on Map<String, dynamic> { Map<String, dynamic> get withoutNulls => Map.fromEntries( entries .where((e) => e.value != null) .map((e) => MapEntry(e.key, e.value!)), ); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/schema/util/firestore_util.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:from_css_color/from_css_color.dart'; import '/backend/schema/util/schema_util.dart'; import '/flutter_flow/flutter_flow_util.dart'; typedef RecordBuilder<T> = T Function(DocumentSnapshot snapshot); abstract class FirestoreRecord { FirestoreRecord(this.reference, this.snapshotData); Map<String, dynamic> snapshotData; DocumentReference reference; } abstract class FFFirebaseStruct extends BaseStruct { FFFirebaseStruct(this.firestoreUtilData); /// Utility class for Firestore updates FirestoreUtilData firestoreUtilData = FirestoreUtilData(); } class FirestoreUtilData { const FirestoreUtilData({ this.fieldValues = const {}, this.clearUnsetFields = true, this.create = false, this.delete = false, }); final Map<String, dynamic> fieldValues; final bool clearUnsetFields; final bool create; final bool delete; static String get name => 'firestoreUtilData'; } Map<String, dynamic> mapFromFirestore(Map<String, dynamic> data) => mergeNestedFields(data) .where((k, _) => k != FirestoreUtilData.name) .map((key, value) { // Handle Timestamp if (value is Timestamp) { value = value.toDate(); } // Handle list of Timestamp if (value is Iterable && value.isNotEmpty && value.first is Timestamp) { value = value.map((v) => (v as Timestamp).toDate()).toList(); } // Handle GeoPoint if (value is GeoPoint) { value = value.toLatLng(); } // Handle list of GeoPoint if (value is Iterable && value.isNotEmpty && value.first is GeoPoint) { value = value.map((v) => (v as GeoPoint).toLatLng()).toList(); } // Handle nested data. if (value is Map) { value = mapFromFirestore(value as Map<String, dynamic>); } // Handle list of nested data. if (value is Iterable && value.isNotEmpty && value.first is Map) { value = value .map((v) => mapFromFirestore(v as Map<String, dynamic>)) .toList(); } return MapEntry(key, value); }); Map<String, dynamic> mapToFirestore(Map<String, dynamic> data) => data.where((k, v) => k != FirestoreUtilData.name).map((key, value) { // Handle GeoPoint if (value is LatLng) { value = value.toGeoPoint(); } // Handle list of GeoPoint if (value is Iterable && value.isNotEmpty && value.first is LatLng) { value = value.map((v) => (v as LatLng).toGeoPoint()).toList(); } // Handle Color if (value is Color) { value = value.toCssString(); } // Handle list of Color if (value is Iterable && value.isNotEmpty && value.first is Color) { value = value.map((v) => (v as Color).toCssString()).toList(); } // Handle nested data. if (value is Map) { value = mapToFirestore(value as Map<String, dynamic>); } // Handle list of nested data. if (value is Iterable && value.isNotEmpty && value.first is Map) { value = value .map((v) => mapToFirestore(v as Map<String, dynamic>)) .toList(); } return MapEntry(key, value); }); List<GeoPoint>? convertToGeoPointList(List<LatLng>? list) => list?.map((e) => e.toGeoPoint()).toList(); extension GeoPointExtension on LatLng { GeoPoint toGeoPoint() => GeoPoint(latitude, longitude); } extension LatLngExtension on GeoPoint { LatLng toLatLng() => LatLng(latitude, longitude); } DocumentReference toRef(String ref) => FirebaseFirestore.instance.doc(ref); T? safeGet<T>(T Function() func, [Function(dynamic)? reportError]) { try { return func(); } catch (e) { reportError?.call(e); } return null; } Map<String, dynamic> mergeNestedFields(Map<String, dynamic> data) { final nestedData = data.where((k, _) => k.contains('.')); final fieldNames = nestedData.keys.map((k) => k.split('.').first).toSet(); // Remove nested values (e.g. 'foo.bar') and merge them into a map. data.removeWhere((k, _) => k.contains('.')); fieldNames.forEach((name) { final mergedValues = mergeNestedFields( nestedData .where((k, _) => k.split('.').first == name) .map((k, v) => MapEntry(k.split('.').skip(1).join('.'), v)), ); final existingValue = data[name]; data[name] = { if (existingValue != null && existingValue is Map) ...existingValue as Map<String, dynamic>, ...mergedValues, }; }); // Merge any nested maps inside any of the fields as well. data.where((_, v) => v is Map).forEach((k, v) { data[k] = mergeNestedFields(v as Map<String, dynamic>); }); return data; } extension _WhereMapExtension<K, V> on Map<K, V> { Map<K, V> where(bool Function(K, V) test) => Map.fromEntries(entries.where((e) => test(e.key, e.value))); }
0
mirrored_repositories/flutterflow_ecommerce_app/lib/backend
mirrored_repositories/flutterflow_ecommerce_app/lib/backend/firebase/firebase_config.dart
import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/foundation.dart'; Future initFirebase() async { if (kIsWeb) { await Firebase.initializeApp( options: FirebaseOptions( apiKey: "AIzaSyCeY-eBIoV2sXQLoX5K-4XxS-J1WkZl5q4", authDomain: "myshopflutterflow.firebaseapp.com", projectId: "myshopflutterflow", storageBucket: "myshopflutterflow.appspot.com", messagingSenderId: "580689695512", appId: "1:580689695512:web:fa79ef5a9d970dfc66846d", measurementId: "G-4PLKSFLFX0")); } else { await Firebase.initializeApp(); } }
0
mirrored_repositories/flutterflow_ecommerce_app
mirrored_repositories/flutterflow_ecommerce_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 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_test/flutter_test.dart'; import 'package:my_shop_flutter_flow/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); }); }
0
mirrored_repositories/The-Flutter-Odyssey
mirrored_repositories/The-Flutter-Odyssey/lib/main.dart
import 'package:flutter/material.dart'; import 'package:namer_app/Final/dashBoard/dashboard.dart'; // import 'Namer_app/NamerApp.dart'; // import 'Sign_in and Sign_up/signin.dart'; // import './TextField.dart'; import 'Demo/demo.dart'; import 'Chat/chat.dart'; import 'Final/Login/Log_in.dart'; import 'Final/Profile/profile.dart'; import 'Final/dashBoard/Ad.dart'; void main() { runApp( // MaterialApp( // debugShowCheckedModeBanner: false, // home: SignIn(), // ) // Chat(), // Demo(), // Login(), // Profile() dashBoard() ); }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Chat/chat_field.dart
import 'package:flutter/material.dart'; class ChatField extends StatelessWidget { @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.symmetric(horizontal: 16.0), margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 0.0), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8.0), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.5), spreadRadius: 1, blurRadius: 3, offset: Offset(0, 2), ), ], ), child: Row( children: [ Expanded( child: TextField( decoration: InputDecoration( hintText: 'Type your message...', border: InputBorder.none, ), ), ), IconButton( icon: Icon(Icons.send), onPressed: () { // Add your send message logic here }, ), ], ), ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Chat/data.dart
const List<Map<String, dynamic>> dummyChatData = [ { 'sender': 'user', 'message': 'Hey there!', 'timestamp': '2023-01-01T12:34:56', }, { 'sender': 'bot', 'message': 'Hi user! How can I assist you today?', 'timestamp': '2023-01-01T12:36:15', }, { 'sender': 'user', 'message': 'I have a question about Flutter.', 'timestamp': '2023-01-01T12:37:42', }, { 'sender': 'bot', 'message': 'Sure, go ahead and ask. Im here to help!', 'timestamp': '2023-01-01T12:39:18', }, { 'sender': 'user', 'message': 'How do I use ListView.builder in Flutter?', 'timestamp': '2023-01-01T12:41:05', }, { 'sender': 'bot', 'message': 'ListView.builder is great for efficiently creating lists in Flutter. You provide a builder function that creates widgets on-demand as they are scrolled into view.', 'timestamp': '2023-01-01T12:43:20', }, ];
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Chat/chat.dart
import "package:flutter/material.dart"; import "package:flutter/services.dart"; import "a_user_msg.dart"; import "bot_msg.dart"; import "chat_field.dart"; import "data.dart"; class Chat extends StatelessWidget { Widget build(BuildContext context) { const List<Map<String, dynamic>> dummyChatData = [ { 'sender': 'user', 'message': 'Hey there!', 'timestamp': '2023-01-01T12:34:56', }, { 'sender': 'bot', 'message': 'Hi user! How can I assist you today?', 'timestamp': '2023-01-01T12:36:15', }, { 'sender': 'user', 'message': 'I have a question about Flutter.', 'timestamp': '2023-01-01T12:37:42', }, { 'sender': 'bot', 'message': 'Sure, go ahead and ask. Im here to help!', 'timestamp': '2023-01-01T12:39:18', }, { 'sender': 'user', 'message': 'How do I use ListView.builder in Flutter?', 'timestamp': '2023-01-01T12:41:05', }, { 'sender': 'bot', 'message': 'ListView.builder is great for efficiently creating lists in Flutter. You provide a builder function that creates widgets on-demand as they are scrolled into view.', 'timestamp': '2023-01-01T12:43:20', }, ]; return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( appBar: AppBar( title: Text("chat", style: TextStyle(color: Colors.white)), centerTitle: true, backgroundColor: Colors.blue[200], ), body: Column( children: [ Expanded( child: ListView( children: dummyChatData.map((message) { if (message['sender'] == 'bot') { return BotMsg(message:'message'); } else { return UserMsg(message:'message'); } }).toList(), ), ), ChatField(), ], ),)); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Chat/bot_msg.dart
import "package:flutter/material.dart"; class BotMsg extends StatelessWidget { final String message; BotMsg({required this.message}); Widget build(BuildContext context) { return ClipRRect( child: Container( decoration: BoxDecoration( color: const Color.fromARGB(255, 47, 90, 124), borderRadius: BorderRadius.only( topLeft: Radius.circular(15.0), topRight: Radius.circular(15.0), bottomLeft: Radius.circular(0.0), bottomRight: Radius.circular(15.0), ), ), padding: EdgeInsets.all(16.0), margin: EdgeInsets.fromLTRB(16.0, 16.0, 100.0, 16.0), // decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.0)), constraints: BoxConstraints( minHeight: 100, // Set your minimum height maxHeight: double.infinity, // Optionally, set a maximum height minWidth: MediaQuery.of(context).size.width * 0.99, maxWidth: MediaQuery.of(context).size.width * 0.99, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon(Icons.chat_bubble), Text( "bot", style: TextStyle( fontWeight: FontWeight.w400, fontSize: 20, ), ), ], ), Text(message) ], ), ), ); ; } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Chat/a_user_msg.dart
import "package:flutter/material.dart"; class UserMsg extends StatelessWidget { final String message; UserMsg({required this.message}); Widget build(BuildContext context) { return Container( decoration: BoxDecoration( color: Colors.blue[100], borderRadius: BorderRadius.only( topLeft: Radius.circular(15.0), topRight: Radius.circular(15.0), bottomLeft: Radius.circular(15.0), bottomRight: Radius.circular(0.0), ), ), constraints: BoxConstraints( minHeight: 100, // Set your minimum height maxHeight: double.infinity, // Optionally, set a maximum height minWidth: MediaQuery.of(context).size.width * 0.99, maxWidth: MediaQuery.of(context).size.width * 0.99, ), padding: EdgeInsets.all(16.0), margin: EdgeInsets.fromLTRB( 100.0, 16.016, 16.0, 16.0, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon(Icons.person_off_outlined), Text( "user", style: TextStyle( fontWeight: FontWeight.w400, fontSize: 20, ), ), ], ), Text( message, ) ], ), ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Login/discription.dart
import "package:flutter/material.dart"; class Discription extends StatelessWidget { Widget build(BuildContext context) { return Align( alignment: Alignment.topLeft, child: Container( width: 300, height: 200, child: Column( children: [ Align( alignment: Alignment.centerLeft, child: Text("Hello,", style: TextStyle( color: Color.fromARGB(255, 0, 136, 20), fontSize: 50, fontWeight: FontWeight.bold, letterSpacing: 1.5, )), ), Align( alignment: Alignment.centerLeft, child: Text("login now.", style: TextStyle( color: Colors.blue[90], fontSize: 50, fontWeight: FontWeight.bold, letterSpacing: 1.5))), SizedBox( height: 20, width: 10, ), Align( alignment: Alignment.centerLeft, child: Text( "welcome back please fillin the form to sign in and continue ", style: TextStyle( color: Colors.blue[90], fontWeight: FontWeight.w300, fontSize: 12, ), ), ), ], )), ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Login/MyTextField.dart
import 'package:flutter/material.dart'; class MyTextField extends StatelessWidget { final String labelText; final bool obscureText; final double width; // final double radius; const MyTextField({ required this.labelText, required this.obscureText, required this.width, // rrequired this.radius }); Widget build(BuildContext context) { return Container( width: width, // color:Colors.green, child: TextField( style: TextStyle(color: Colors.green), obscureText: obscureText, decoration: InputDecoration( labelText: labelText, labelStyle: TextStyle( color: Colors.green, ), enabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.green), ), focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.green), ), )), ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Login/button.dart
import 'package:flutter/material.dart'; class Button extends StatelessWidget { // final double radius; final String label; final double width; final double height; final double radius; const Button( {required this.label, required this.width, required this.height, required this.radius}); Widget build(BuildContext context) { return Container( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 0.0, vertical: 15.0), // child: Expanded( child: Container( width: width, height: height, decoration: BoxDecoration( borderRadius: BorderRadius.circular(radius), color: Colors.green, ), child: Center( child: Text( label, style: TextStyle(color: Colors.white), ), // ), ), ), ), ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Login/Log_in.dart
import 'package:flutter/material.dart'; import "discription.dart"; import "MyTextField.dart"; import "button.dart"; class Login extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: Padding( padding: const EdgeInsets.all(12.0), child: Align( alignment: Alignment.bottomLeft, child: Container( width: 400, height: 500, child: Column( children: [ Discription(), MyTextField( labelText: "Login", obscureText: false, width: 600, // radius: 20.0, ), MyTextField( labelText: "Password", obscureText: true, width: 600, // radius: 20.0, ), Align(alignment: Alignment.bottomRight, child: TextButton( child: Text( "forget password? ", style: TextStyle(color: Colors.blue[400]), ), onPressed: () {}, ), ), Button( height: 50, label: "Login", width: 600, radius: 20, ), ], ), ), ), ))); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Profile/profile.dart
import "package:flutter/material.dart"; import "banner.dart"; import 'info.dart'; class Profile extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: Column( children: [ Baner(), Info(text: "Name" ,info:"Jessica"), Info(text: "Surname" ,info:"Simpson"), Info(text: "Date of Birth" ,info:"july,16,1990"), Info(text: "City " ,info:"London"), Info(text: "Country" ,info:"Uk"), ], ))); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Profile/button.dart
import 'package:flutter/material.dart'; class Button extends StatelessWidget { // final double radius; final String label; final double width; final double height; final double radius; final Color color; const Button( {required this.label, required this.width, required this.height, required this.radius, required this.color}); Widget build(BuildContext context) { return Container( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 0.0, vertical: 15.0), // child: Expanded( child: Container( width: width, height: height, decoration: BoxDecoration( borderRadius: BorderRadius.circular(radius), color: color, ), child: Center( child: Text( label, style: TextStyle(color: Colors.white), ), // ), ), ), ), ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Profile/banner.dart
import "package:flutter/material.dart"; import "button.dart"; class Baner extends StatelessWidget { Widget build(BuildContext context) { return Container( width: double.infinity, color: Color.fromARGB(255, 6, 92, 162), child: Column( children: [ SizedBox(height: 100,), Container( width: 80, height: 80, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100.0), image: DecorationImage( image: AssetImage( 'assets/images/black.jpg', ), fit: BoxFit.cover, )), ), SizedBox(height:20,), Text("jassica Simpson",style:TextStyle(color: Colors.white,fontWeight: FontWeight.w800 ,fontSize:17 ,letterSpacing: 1.5 ,)), Text("Female",style:TextStyle(color: Colors.white ,fontSize:12)), Button(label: "Edit Profile", width: 200, height: 40, radius: 30,color:Color.fromARGB(255, 85, 198, 164)) ], )); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/Profile/info.dart
import "package:flutter/material.dart"; class Info extends StatelessWidget { final String text; final String info; Info({required this.text, required this.info}); Widget build(BuildContext context) { return Container( child: Row( children: [ Padding( padding: const EdgeInsets.all(28.0), child: Icon( Icons.circle_rounded, size: 7, color: Color.fromARGB(255, 85, 198, 164), ), ), Column( children: [ Text( text, style: TextStyle( color: Colors.black54, fontSize: 12, fontWeight: FontWeight.w300), // textAlign: TextAlign.left, ), Text( info, style: TextStyle( color: Colors.black, fontSize: 13, fontWeight: FontWeight.w700), textAlign: TextAlign.center, ) ], ), ], )); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/dashBoard/card.dart
import "package:flutter/material.dart"; class CatagoryCard extends StatelessWidget { Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(14.0), // Add 16 pixels of padding on all sides // color: Color.fromARGB(255, 114, 199, 207), width: 300, height: 150, decoration: BoxDecoration( boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.5), spreadRadius: 2, blurRadius: 5, offset: Offset(0, 3), // Offset of the shadow ), ], borderRadius: BorderRadius.circular(10), color:Colors.white, border: Border()), // Container( // decoration: BoxDecoration( // boxShadow: [ // BoxShadow( // color: Colors.grey.withOpacity(0.5), // spreadRadius: 2, // blurRadius: 5, // offset: Offset(0, 3), // Offset of the shadow // ), // ], // ), // // Your child widgets // ) child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only (right:10), child: Icon(Icons.health_and_safety_rounded, color: Color.fromARGB(255, 221, 17, 3), size: 40), ), Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "patient catagory", style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.w600, color: Colors.black), ), // alignment: AlignmentGeometry alignment = Alignment.topLeft, Text( "some description", style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.w200, color: Colors.grey[400]), textAlign: TextAlign.left, ), ]), ], ), SizedBox(height: 30), Row( children: [ Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "patient catagory", style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.w600, color: Colors.black), ), // alignment: AlignmentGeometry alignment = Alignment.topLeft, Text( "some description", style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.w200, color: Colors.grey[400]), textAlign: TextAlign.left, ), ]), SizedBox(width: 20), Text( "some description", style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.w200, color: Colors.grey[400]), textAlign: TextAlign.left, ) ], ) ], ), ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/dashBoard/ad.dart
import "package:flutter/material.dart"; class Ad extends StatelessWidget { const Ad({super.key}); @override Widget build(BuildContext context) { return Container( child:Image.asset('assets/black.jpg', width:10.0 , height: 10.0,) ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Final
mirrored_repositories/The-Flutter-Odyssey/lib/Final/dashBoard/dashboard.dart
import "package:flutter/material.dart"; import "ad.dart"; import "card.dart"; class dashBoard extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Column( children: [ Ad(), CatagoryCard(), ], )); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib
mirrored_repositories/The-Flutter-Odyssey/lib/Vid/call.dart
import "package:flutter/material.dart"; import 'package:agora_rtc_engine/agora_rtc_engine.dart'; import "package:permission_handler/permission_handler.dart"; import 'package:agora_rtc_engine/rtc_local_view.dart' as RtcLocalView; import "package:agora_rtc_engine/rtc_remote_view.dart" as RtcRemoteView; const AppID = "505a9ec196214b0db10c12bd06a7c237"; const Token = "007eJxTYJD7G1O9WIctrFyC9/IFgXfWT50+PqySmmf1VTK4xKboYrACg7FJooGBRVKamUmymUlSSpqlualxorFRmoU5ECSmJs3pS01tCGRkOBbOzMrIAIEgPitDTmpiUR4DAwALfR6F"; class VideoChat extends StatefulWidget { State createState() => VideoChatState(); } class VideoChatState extends State<VideoChat> { int _remoteUid = 0; RtcEngine? _engine; @override void initState() { super.initState(); initForAgora(); } Future<void> initForAgora() async { await [Permission.microphone, Permission.camera].request(); _engine = await RtcEngine.createWithConfig(RtcEngineConfig(AppID)); await _engine.enableVideo(); _engine.setEventHandler(RtcEngineEventHandler( onJoinChannelSuccess: (String channel, int uid, int elapsed) { print("local user $uid joind"); }, onUserJoined: (int uid, int elapsed) { print("remote user $uid joind"); setState((){ _remoteUid = uid; }) }, userOffLine: (int uid, UserOffLineReason reason) { print("remote user $uid left"); setState(() { _remoteUid = null; }); })); await _engine.joinChannel(token,"learn",null,0); } Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text("v chat")), body: Stack( children: [ Center( child: _renderRemoteVideo(), ), Align( alignment: Alignment.topLeft, child: Container( width: 100, height: 100, child: Center( child: _renderLocalPreview(), ))) ], ), ); } } Widget _renderLocalPreview() { return Container(); } Widget _renderRemotePreview() { if (_remoteUid != null) { return Container(); } else { return Text( "please wait for the remote", textAlign: TextAlign.center, ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib/Api
mirrored_repositories/The-Flutter-Odyssey/lib/Api/Pokémon/pokemon_model.dart
class pokemon_model
0
mirrored_repositories/The-Flutter-Odyssey/lib/Api
mirrored_repositories/The-Flutter-Odyssey/lib/Api/Pokémon/home.dart
import "package:flutter/material.dart"; import "package:http/http.dart" as http; import "dart:convert"; class Home extends StatefulWidget { State createState() => HomeState(); } class HomeState extends State<Home> { Future<void> fetchData() async { final response = await http.get(Uri.parse("https://pokeapi.co/api/v2/pokemon/ditto")); } Widget build(BuildContext context) { return Scaffold(); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib
mirrored_repositories/The-Flutter-Odyssey/lib/Chat/chat_field.dart
import 'package:flutter/material.dart'; class ChatField extends StatelessWidget { @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.symmetric(horizontal: 16.0), margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 0.0), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8.0), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.5), spreadRadius: 1, blurRadius: 3, offset: Offset(0, 2), ), ], ), child: Row( children: [ Expanded( child: TextField( decoration: InputDecoration( hintText: 'Type your message...', border: InputBorder.none, ), ), ), IconButton( icon: Icon(Icons.send), onPressed: () { // Add your send message logic here }, ), ], ), ); } }
0
mirrored_repositories/The-Flutter-Odyssey/lib
mirrored_repositories/The-Flutter-Odyssey/lib/Chat/data.dart
const List<Map<String, dynamic>> dummyChatData = [ { 'sender': 'user', 'message': 'Hey there!', 'timestamp': '2023-01-01T12:34:56', }, { 'sender': 'bot', 'message': 'Hi user! How can I assist you today?', 'timestamp': '2023-01-01T12:36:15', }, { 'sender': 'user', 'message': 'I have a question about Flutter.', 'timestamp': '2023-01-01T12:37:42', }, { 'sender': 'bot', 'message': 'Sure, go ahead and ask. Im here to help!', 'timestamp': '2023-01-01T12:39:18', }, { 'sender': 'user', 'message': 'How do I use ListView.builder in Flutter?', 'timestamp': '2023-01-01T12:41:05', }, { 'sender': 'bot', 'message': 'ListView.builder is great for efficiently creating lists in Flutter. You provide a builder function that creates widgets on-demand as they are scrolled into view.', 'timestamp': '2023-01-01T12:43:20', }, ];
0
mirrored_repositories/The-Flutter-Odyssey/lib
mirrored_repositories/The-Flutter-Odyssey/lib/Chat/chat.dart
import "package:flutter/material.dart"; import "package:flutter/services.dart"; import "a_user_msg.dart"; import "bot_msg.dart"; import "chat_field.dart"; import "data.dart"; class Chat extends StatelessWidget { Widget build(BuildContext context) { const List<Map<String, dynamic>> dummyChatData = [ { 'sender': 'user', 'message': 'Hey there!', 'timestamp': '2023-01-01T12:34:56', }, { 'sender': 'bot', 'message': 'Hi user! How can I assist you today?', 'timestamp': '2023-01-01T12:36:15', }, { 'sender': 'user', 'message': 'I have a question about Flutter.', 'timestamp': '2023-01-01T12:37:42', }, { 'sender': 'bot', 'message': 'Sure, go ahead and ask. Im here to help!', 'timestamp': '2023-01-01T12:39:18', }, { 'sender': 'user', 'message': 'How do I use ListView.builder in Flutter?', 'timestamp': '2023-01-01T12:41:05', }, { 'sender': 'bot', 'message': 'ListView.builder is great for efficiently creating lists in Flutter. You provide a builder function that creates widgets on-demand as they are scrolled into view.', 'timestamp': '2023-01-01T12:43:20', }, ]; return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( appBar: AppBar( title: Text("chat", style: TextStyle(color: Colors.white)), centerTitle: true, backgroundColor: Colors.blue[200], ), body: Column( children: [ Expanded( child: ListView( children: dummyChatData.map((message) { if (message['sender'] == 'bot') { return BotMsg(message:'message'); } else { return UserMsg(message:'message'); } }).toList(), ), ), ChatField(), ], ),)); } }
0