repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/auth/auth_failure.dart
import 'package:freezed_annotation/freezed_annotation.dart'; part 'auth_failure.freezed.dart'; @freezed abstract class AuthFailure with _$AuthFailure { const factory AuthFailure.cancelledByUser() = CancelledByUser; const factory AuthFailure.serverError() = ServerError; const factory AuthFailure.unexpected() = Unexpected; }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/auth/app_user.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'app_user.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; AppUser _$AppUserFromJson(Map<String, dynamic> json) { return _AppUser.fromJson(json); } /// @nodoc class _$AppUserTearOff { const _$AppUserTearOff(); // ignore: unused_element _AppUser call( {@JsonKey(ignore: true) String id, @required String name, @required String photoURL, @required String email}) { return _AppUser( id: id, name: name, photoURL: photoURL, email: email, ); } // ignore: unused_element AppUser fromJson(Map<String, Object> json) { return AppUser.fromJson(json); } } /// @nodoc // ignore: unused_element const $AppUser = _$AppUserTearOff(); /// @nodoc mixin _$AppUser { @JsonKey(ignore: true) String get id; String get name; String get photoURL; String get email; Map<String, dynamic> toJson(); $AppUserCopyWith<AppUser> get copyWith; } /// @nodoc abstract class $AppUserCopyWith<$Res> { factory $AppUserCopyWith(AppUser value, $Res Function(AppUser) then) = _$AppUserCopyWithImpl<$Res>; $Res call( {@JsonKey(ignore: true) String id, String name, String photoURL, String email}); } /// @nodoc class _$AppUserCopyWithImpl<$Res> implements $AppUserCopyWith<$Res> { _$AppUserCopyWithImpl(this._value, this._then); final AppUser _value; // ignore: unused_field final $Res Function(AppUser) _then; @override $Res call({ Object id = freezed, Object name = freezed, Object photoURL = freezed, Object email = freezed, }) { return _then(_value.copyWith( id: id == freezed ? _value.id : id as String, name: name == freezed ? _value.name : name as String, photoURL: photoURL == freezed ? _value.photoURL : photoURL as String, email: email == freezed ? _value.email : email as String, )); } } /// @nodoc abstract class _$AppUserCopyWith<$Res> implements $AppUserCopyWith<$Res> { factory _$AppUserCopyWith(_AppUser value, $Res Function(_AppUser) then) = __$AppUserCopyWithImpl<$Res>; @override $Res call( {@JsonKey(ignore: true) String id, String name, String photoURL, String email}); } /// @nodoc class __$AppUserCopyWithImpl<$Res> extends _$AppUserCopyWithImpl<$Res> implements _$AppUserCopyWith<$Res> { __$AppUserCopyWithImpl(_AppUser _value, $Res Function(_AppUser) _then) : super(_value, (v) => _then(v as _AppUser)); @override _AppUser get _value => super._value as _AppUser; @override $Res call({ Object id = freezed, Object name = freezed, Object photoURL = freezed, Object email = freezed, }) { return _then(_AppUser( id: id == freezed ? _value.id : id as String, name: name == freezed ? _value.name : name as String, photoURL: photoURL == freezed ? _value.photoURL : photoURL as String, email: email == freezed ? _value.email : email as String, )); } } @JsonSerializable() /// @nodoc class _$_AppUser extends _AppUser { const _$_AppUser( {@JsonKey(ignore: true) this.id, @required this.name, @required this.photoURL, @required this.email}) : assert(name != null), assert(photoURL != null), assert(email != null), super._(); factory _$_AppUser.fromJson(Map<String, dynamic> json) => _$_$_AppUserFromJson(json); @override @JsonKey(ignore: true) final String id; @override final String name; @override final String photoURL; @override final String email; @override String toString() { return 'AppUser(id: $id, name: $name, photoURL: $photoURL, email: $email)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _AppUser && (identical(other.id, id) || const DeepCollectionEquality().equals(other.id, id)) && (identical(other.name, name) || const DeepCollectionEquality().equals(other.name, name)) && (identical(other.photoURL, photoURL) || const DeepCollectionEquality() .equals(other.photoURL, photoURL)) && (identical(other.email, email) || const DeepCollectionEquality().equals(other.email, email))); } @override int get hashCode => runtimeType.hashCode ^ const DeepCollectionEquality().hash(id) ^ const DeepCollectionEquality().hash(name) ^ const DeepCollectionEquality().hash(photoURL) ^ const DeepCollectionEquality().hash(email); @override _$AppUserCopyWith<_AppUser> get copyWith => __$AppUserCopyWithImpl<_AppUser>(this, _$identity); @override Map<String, dynamic> toJson() { return _$_$_AppUserToJson(this); } } abstract class _AppUser extends AppUser { const _AppUser._() : super._(); const factory _AppUser( {@JsonKey(ignore: true) String id, @required String name, @required String photoURL, @required String email}) = _$_AppUser; factory _AppUser.fromJson(Map<String, dynamic> json) = _$_AppUser.fromJson; @override @JsonKey(ignore: true) String get id; @override String get name; @override String get photoURL; @override String get email; @override _$AppUserCopyWith<_AppUser> get copyWith; }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/auth/auth_failure.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'auth_failure.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; /// @nodoc class _$AuthFailureTearOff { const _$AuthFailureTearOff(); // ignore: unused_element CancelledByUser cancelledByUser() { return const CancelledByUser(); } // ignore: unused_element ServerError serverError() { return const ServerError(); } // ignore: unused_element Unexpected unexpected() { return const Unexpected(); } } /// @nodoc // ignore: unused_element const $AuthFailure = _$AuthFailureTearOff(); /// @nodoc mixin _$AuthFailure { @optionalTypeArgs Result when<Result extends Object>({ @required Result cancelledByUser(), @required Result serverError(), @required Result unexpected(), }); @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result cancelledByUser(), Result serverError(), Result unexpected(), @required Result orElse(), }); @optionalTypeArgs Result map<Result extends Object>({ @required Result cancelledByUser(CancelledByUser value), @required Result serverError(ServerError value), @required Result unexpected(Unexpected value), }); @optionalTypeArgs Result maybeMap<Result extends Object>({ Result cancelledByUser(CancelledByUser value), Result serverError(ServerError value), Result unexpected(Unexpected value), @required Result orElse(), }); } /// @nodoc abstract class $AuthFailureCopyWith<$Res> { factory $AuthFailureCopyWith( AuthFailure value, $Res Function(AuthFailure) then) = _$AuthFailureCopyWithImpl<$Res>; } /// @nodoc class _$AuthFailureCopyWithImpl<$Res> implements $AuthFailureCopyWith<$Res> { _$AuthFailureCopyWithImpl(this._value, this._then); final AuthFailure _value; // ignore: unused_field final $Res Function(AuthFailure) _then; } /// @nodoc abstract class $CancelledByUserCopyWith<$Res> { factory $CancelledByUserCopyWith( CancelledByUser value, $Res Function(CancelledByUser) then) = _$CancelledByUserCopyWithImpl<$Res>; } /// @nodoc class _$CancelledByUserCopyWithImpl<$Res> extends _$AuthFailureCopyWithImpl<$Res> implements $CancelledByUserCopyWith<$Res> { _$CancelledByUserCopyWithImpl( CancelledByUser _value, $Res Function(CancelledByUser) _then) : super(_value, (v) => _then(v as CancelledByUser)); @override CancelledByUser get _value => super._value as CancelledByUser; } /// @nodoc class _$CancelledByUser implements CancelledByUser { const _$CancelledByUser(); @override String toString() { return 'AuthFailure.cancelledByUser()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is CancelledByUser); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result cancelledByUser(), @required Result serverError(), @required Result unexpected(), }) { assert(cancelledByUser != null); assert(serverError != null); assert(unexpected != null); return cancelledByUser(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result cancelledByUser(), Result serverError(), Result unexpected(), @required Result orElse(), }) { assert(orElse != null); if (cancelledByUser != null) { return cancelledByUser(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result cancelledByUser(CancelledByUser value), @required Result serverError(ServerError value), @required Result unexpected(Unexpected value), }) { assert(cancelledByUser != null); assert(serverError != null); assert(unexpected != null); return cancelledByUser(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result cancelledByUser(CancelledByUser value), Result serverError(ServerError value), Result unexpected(Unexpected value), @required Result orElse(), }) { assert(orElse != null); if (cancelledByUser != null) { return cancelledByUser(this); } return orElse(); } } abstract class CancelledByUser implements AuthFailure { const factory CancelledByUser() = _$CancelledByUser; } /// @nodoc abstract class $ServerErrorCopyWith<$Res> { factory $ServerErrorCopyWith( ServerError value, $Res Function(ServerError) then) = _$ServerErrorCopyWithImpl<$Res>; } /// @nodoc class _$ServerErrorCopyWithImpl<$Res> extends _$AuthFailureCopyWithImpl<$Res> implements $ServerErrorCopyWith<$Res> { _$ServerErrorCopyWithImpl( ServerError _value, $Res Function(ServerError) _then) : super(_value, (v) => _then(v as ServerError)); @override ServerError get _value => super._value as ServerError; } /// @nodoc class _$ServerError implements ServerError { const _$ServerError(); @override String toString() { return 'AuthFailure.serverError()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is ServerError); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result cancelledByUser(), @required Result serverError(), @required Result unexpected(), }) { assert(cancelledByUser != null); assert(serverError != null); assert(unexpected != null); return serverError(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result cancelledByUser(), Result serverError(), Result unexpected(), @required Result orElse(), }) { assert(orElse != null); if (serverError != null) { return serverError(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result cancelledByUser(CancelledByUser value), @required Result serverError(ServerError value), @required Result unexpected(Unexpected value), }) { assert(cancelledByUser != null); assert(serverError != null); assert(unexpected != null); return serverError(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result cancelledByUser(CancelledByUser value), Result serverError(ServerError value), Result unexpected(Unexpected value), @required Result orElse(), }) { assert(orElse != null); if (serverError != null) { return serverError(this); } return orElse(); } } abstract class ServerError implements AuthFailure { const factory ServerError() = _$ServerError; } /// @nodoc abstract class $UnexpectedCopyWith<$Res> { factory $UnexpectedCopyWith( Unexpected value, $Res Function(Unexpected) then) = _$UnexpectedCopyWithImpl<$Res>; } /// @nodoc class _$UnexpectedCopyWithImpl<$Res> extends _$AuthFailureCopyWithImpl<$Res> implements $UnexpectedCopyWith<$Res> { _$UnexpectedCopyWithImpl(Unexpected _value, $Res Function(Unexpected) _then) : super(_value, (v) => _then(v as Unexpected)); @override Unexpected get _value => super._value as Unexpected; } /// @nodoc class _$Unexpected implements Unexpected { const _$Unexpected(); @override String toString() { return 'AuthFailure.unexpected()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is Unexpected); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result cancelledByUser(), @required Result serverError(), @required Result unexpected(), }) { assert(cancelledByUser != null); assert(serverError != null); assert(unexpected != null); return unexpected(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result cancelledByUser(), Result serverError(), Result unexpected(), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result cancelledByUser(CancelledByUser value), @required Result serverError(ServerError value), @required Result unexpected(Unexpected value), }) { assert(cancelledByUser != null); assert(serverError != null); assert(unexpected != null); return unexpected(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result cancelledByUser(CancelledByUser value), Result serverError(ServerError value), Result unexpected(Unexpected value), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(this); } return orElse(); } } abstract class Unexpected implements AuthFailure { const factory Unexpected() = _$Unexpected; }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/auth/app_user_failure.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'app_user_failure.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; /// @nodoc class _$AppUserFailureTearOff { const _$AppUserFailureTearOff(); // ignore: unused_element _Unexpected unexpected() { return const _Unexpected(); } // ignore: unused_element _InsufficientPermissions insufficientPermissions() { return const _InsufficientPermissions(); } } /// @nodoc // ignore: unused_element const $AppUserFailure = _$AppUserFailureTearOff(); /// @nodoc mixin _$AppUserFailure { @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result insufficientPermissions(), }); @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result insufficientPermissions(), @required Result orElse(), }); @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result insufficientPermissions(_InsufficientPermissions value), }); @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }); } /// @nodoc abstract class $AppUserFailureCopyWith<$Res> { factory $AppUserFailureCopyWith( AppUserFailure value, $Res Function(AppUserFailure) then) = _$AppUserFailureCopyWithImpl<$Res>; } /// @nodoc class _$AppUserFailureCopyWithImpl<$Res> implements $AppUserFailureCopyWith<$Res> { _$AppUserFailureCopyWithImpl(this._value, this._then); final AppUserFailure _value; // ignore: unused_field final $Res Function(AppUserFailure) _then; } /// @nodoc abstract class _$UnexpectedCopyWith<$Res> { factory _$UnexpectedCopyWith( _Unexpected value, $Res Function(_Unexpected) then) = __$UnexpectedCopyWithImpl<$Res>; } /// @nodoc class __$UnexpectedCopyWithImpl<$Res> extends _$AppUserFailureCopyWithImpl<$Res> implements _$UnexpectedCopyWith<$Res> { __$UnexpectedCopyWithImpl( _Unexpected _value, $Res Function(_Unexpected) _then) : super(_value, (v) => _then(v as _Unexpected)); @override _Unexpected get _value => super._value as _Unexpected; } /// @nodoc class _$_Unexpected implements _Unexpected { const _$_Unexpected(); @override String toString() { return 'AppUserFailure.unexpected()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Unexpected); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(insufficientPermissions != null); return unexpected(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(insufficientPermissions != null); return unexpected(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(this); } return orElse(); } } abstract class _Unexpected implements AppUserFailure { const factory _Unexpected() = _$_Unexpected; } /// @nodoc abstract class _$InsufficientPermissionsCopyWith<$Res> { factory _$InsufficientPermissionsCopyWith(_InsufficientPermissions value, $Res Function(_InsufficientPermissions) then) = __$InsufficientPermissionsCopyWithImpl<$Res>; } /// @nodoc class __$InsufficientPermissionsCopyWithImpl<$Res> extends _$AppUserFailureCopyWithImpl<$Res> implements _$InsufficientPermissionsCopyWith<$Res> { __$InsufficientPermissionsCopyWithImpl(_InsufficientPermissions _value, $Res Function(_InsufficientPermissions) _then) : super(_value, (v) => _then(v as _InsufficientPermissions)); @override _InsufficientPermissions get _value => super._value as _InsufficientPermissions; } /// @nodoc class _$_InsufficientPermissions implements _InsufficientPermissions { const _$_InsufficientPermissions(); @override String toString() { return 'AppUserFailure.insufficientPermissions()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _InsufficientPermissions); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(insufficientPermissions != null); return insufficientPermissions(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (insufficientPermissions != null) { return insufficientPermissions(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(insufficientPermissions != null); return insufficientPermissions(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (insufficientPermissions != null) { return insufficientPermissions(this); } return orElse(); } } abstract class _InsufficientPermissions implements AppUserFailure { const factory _InsufficientPermissions() = _$_InsufficientPermissions; }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/auth/app_user.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/cupertino.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'app_user.freezed.dart'; part 'app_user.g.dart'; @freezed abstract class AppUser implements _$AppUser { const factory AppUser({ @JsonKey(ignore: true) String id, @required String name, @required String photoURL, @required String email, }) = _AppUser; const AppUser._(); AppUser toDomain() { return AppUser( id: id, name: name, photoURL: photoURL, email: email, ); } factory AppUser.fromJson(Map<String, dynamic> json) => _$AppUserFromJson(json); factory AppUser.fromFirebase(DocumentSnapshot doc) { return AppUser.fromJson(doc.data()).copyWith(id: doc.id); } }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/auth/auth_repository_interface.dart
import 'package:dartz/dartz.dart'; import 'app_user.dart'; import 'app_user_failure.dart'; import 'auth_failure.dart'; abstract class AuthInterface { // [Unit] can be read as void. Future<Either<AuthFailure, Unit>> signInWithGoogle(); Future<Option<AppUser>> getSignedInUser(); Future<Either<AuthFailure, Unit>> storeGoogleUser(); Future<void> signOut(); Stream<Either<AppUserFailure, AppUser>> watchUserProfile(); }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/auth/app_user_failure.dart
import 'package:freezed_annotation/freezed_annotation.dart'; part 'app_user_failure.freezed.dart'; @freezed abstract class AppUserFailure with _$AppUserFailure { const factory AppUserFailure.unexpected() = _Unexpected; const factory AppUserFailure.insufficientPermissions() = _InsufficientPermissions; }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/auth/app_user.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'app_user.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** _$_AppUser _$_$_AppUserFromJson(Map<String, dynamic> json) { return _$_AppUser( name: json['name'] as String, photoURL: json['photoURL'] as String, email: json['email'] as String, ); } Map<String, dynamic> _$_$_AppUserToJson(_$_AppUser instance) => <String, dynamic>{ 'name': instance.name, 'photoURL': instance.photoURL, 'email': instance.email, };
0
mirrored_repositories/movingPictures/lib/domain/home
mirrored_repositories/movingPictures/lib/domain/home/series/series_interface.dart
import 'package:dartz/dartz.dart'; import '../shared_classes/cast/cast.dart'; import '../shared_classes/cast/cast_failure.dart'; import '../shared_classes/genres/genre.dart'; import '../shared_classes/genres/genre_failure.dart'; import 'serie/serie.dart'; import 'serie/serie_failure.dart'; import 'serie_sub/serie_sub.dart'; abstract class SeriesInterface { Future<Either<SerieFailure, Serie>> getSerie(int serieId); Future<Either<SerieFailure, List<SerieSub>>> getSerieListType( String seriesListType); Future<Either<SerieFailure, List<SerieSub>>> getSimilarSeries(int serieId); Future<Either<GenreFailure, List<Genre>>> getGenres(); Future<Either<SerieFailure, List<SerieSub>>> getSerieByGenre( int serieGenreId); Future<Either<CastFailure, List<Cast>>> getCast(int serieId); Future<Either<SerieFailure, List<SerieSub>>> getSerieByCastId(int castId); }
0
mirrored_repositories/movingPictures/lib/domain/home
mirrored_repositories/movingPictures/lib/domain/home/series/favorite_series_interface.dart
import 'package:dartz/dartz.dart'; import 'favorite_serie/favorite_serie.dart'; import 'serie/serie_failure.dart'; abstract class FavoriteSeriesInterface { Stream<Either<SerieFailure, List<FavoriteSerie>>> watchSerieFavorites(); Future<Either<SerieFailure, Unit>> createFavoriteSerie(int serieId); Future<Either<SerieFailure, Unit>> deleteFavoriteSerie(int serieId); }
0
mirrored_repositories/movingPictures/lib/domain/home/series
mirrored_repositories/movingPictures/lib/domain/home/series/favorite_serie/favorite_serie.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:equatable/equatable.dart'; class FavoriteSerie extends Equatable { final int favoriteSerieId; const FavoriteSerie({int favoriteSerieId}) : favoriteSerieId = favoriteSerieId ?? favoriteSerieId, super(); Map<String, dynamic> toJson() => {"id": favoriteSerieId}; factory FavoriteSerie.fromJsonData(Map<String, dynamic> json) => FavoriteSerie(favoriteSerieId: json["id"] as int ?? -0); factory FavoriteSerie.fromFirebase(DocumentSnapshot doc) => FavoriteSerie.fromJsonData(doc.data()); @override List<Object> get props => [favoriteSerieId]; }
0
mirrored_repositories/movingPictures/lib/domain/home/series
mirrored_repositories/movingPictures/lib/domain/home/series/serie/serie.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'serie.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; Serie _$SerieFromJson(Map<String, dynamic> json) { return _Serie.fromJson(json); } /// @nodoc class _$SerieTearOff { const _$SerieTearOff(); // ignore: unused_element _Serie call( {@required DateTime firstAirDate, @required List<Genre> genres, @required String homepage, @required int id, @required String name, @required int numberOfEpisodes, @required int numberOfSeasons, @required String overview, @required String posterPath, @required String type, @required double voteAverage, @required ContentRatings contentRatings, @required Videos videos}) { return _Serie( firstAirDate: firstAirDate, genres: genres, homepage: homepage, id: id, name: name, numberOfEpisodes: numberOfEpisodes, numberOfSeasons: numberOfSeasons, overview: overview, posterPath: posterPath, type: type, voteAverage: voteAverage, contentRatings: contentRatings, videos: videos, ); } // ignore: unused_element Serie fromJson(Map<String, Object> json) { return Serie.fromJson(json); } } /// @nodoc // ignore: unused_element const $Serie = _$SerieTearOff(); /// @nodoc mixin _$Serie { DateTime get firstAirDate; List<Genre> get genres; String get homepage; int get id; String get name; int get numberOfEpisodes; int get numberOfSeasons; String get overview; String get posterPath; String get type; double get voteAverage; ContentRatings get contentRatings; Videos get videos; Map<String, dynamic> toJson(); $SerieCopyWith<Serie> get copyWith; } /// @nodoc abstract class $SerieCopyWith<$Res> { factory $SerieCopyWith(Serie value, $Res Function(Serie) then) = _$SerieCopyWithImpl<$Res>; $Res call( {DateTime firstAirDate, List<Genre> genres, String homepage, int id, String name, int numberOfEpisodes, int numberOfSeasons, String overview, String posterPath, String type, double voteAverage, ContentRatings contentRatings, Videos videos}); } /// @nodoc class _$SerieCopyWithImpl<$Res> implements $SerieCopyWith<$Res> { _$SerieCopyWithImpl(this._value, this._then); final Serie _value; // ignore: unused_field final $Res Function(Serie) _then; @override $Res call({ Object firstAirDate = freezed, Object genres = freezed, Object homepage = freezed, Object id = freezed, Object name = freezed, Object numberOfEpisodes = freezed, Object numberOfSeasons = freezed, Object overview = freezed, Object posterPath = freezed, Object type = freezed, Object voteAverage = freezed, Object contentRatings = freezed, Object videos = freezed, }) { return _then(_value.copyWith( firstAirDate: firstAirDate == freezed ? _value.firstAirDate : firstAirDate as DateTime, genres: genres == freezed ? _value.genres : genres as List<Genre>, homepage: homepage == freezed ? _value.homepage : homepage as String, id: id == freezed ? _value.id : id as int, name: name == freezed ? _value.name : name as String, numberOfEpisodes: numberOfEpisodes == freezed ? _value.numberOfEpisodes : numberOfEpisodes as int, numberOfSeasons: numberOfSeasons == freezed ? _value.numberOfSeasons : numberOfSeasons as int, overview: overview == freezed ? _value.overview : overview as String, posterPath: posterPath == freezed ? _value.posterPath : posterPath as String, type: type == freezed ? _value.type : type as String, voteAverage: voteAverage == freezed ? _value.voteAverage : voteAverage as double, contentRatings: contentRatings == freezed ? _value.contentRatings : contentRatings as ContentRatings, videos: videos == freezed ? _value.videos : videos as Videos, )); } } /// @nodoc abstract class _$SerieCopyWith<$Res> implements $SerieCopyWith<$Res> { factory _$SerieCopyWith(_Serie value, $Res Function(_Serie) then) = __$SerieCopyWithImpl<$Res>; @override $Res call( {DateTime firstAirDate, List<Genre> genres, String homepage, int id, String name, int numberOfEpisodes, int numberOfSeasons, String overview, String posterPath, String type, double voteAverage, ContentRatings contentRatings, Videos videos}); } /// @nodoc class __$SerieCopyWithImpl<$Res> extends _$SerieCopyWithImpl<$Res> implements _$SerieCopyWith<$Res> { __$SerieCopyWithImpl(_Serie _value, $Res Function(_Serie) _then) : super(_value, (v) => _then(v as _Serie)); @override _Serie get _value => super._value as _Serie; @override $Res call({ Object firstAirDate = freezed, Object genres = freezed, Object homepage = freezed, Object id = freezed, Object name = freezed, Object numberOfEpisodes = freezed, Object numberOfSeasons = freezed, Object overview = freezed, Object posterPath = freezed, Object type = freezed, Object voteAverage = freezed, Object contentRatings = freezed, Object videos = freezed, }) { return _then(_Serie( firstAirDate: firstAirDate == freezed ? _value.firstAirDate : firstAirDate as DateTime, genres: genres == freezed ? _value.genres : genres as List<Genre>, homepage: homepage == freezed ? _value.homepage : homepage as String, id: id == freezed ? _value.id : id as int, name: name == freezed ? _value.name : name as String, numberOfEpisodes: numberOfEpisodes == freezed ? _value.numberOfEpisodes : numberOfEpisodes as int, numberOfSeasons: numberOfSeasons == freezed ? _value.numberOfSeasons : numberOfSeasons as int, overview: overview == freezed ? _value.overview : overview as String, posterPath: posterPath == freezed ? _value.posterPath : posterPath as String, type: type == freezed ? _value.type : type as String, voteAverage: voteAverage == freezed ? _value.voteAverage : voteAverage as double, contentRatings: contentRatings == freezed ? _value.contentRatings : contentRatings as ContentRatings, videos: videos == freezed ? _value.videos : videos as Videos, )); } } @JsonSerializable() /// @nodoc class _$_Serie extends _Serie { const _$_Serie( {@required this.firstAirDate, @required this.genres, @required this.homepage, @required this.id, @required this.name, @required this.numberOfEpisodes, @required this.numberOfSeasons, @required this.overview, @required this.posterPath, @required this.type, @required this.voteAverage, @required this.contentRatings, @required this.videos}) : assert(firstAirDate != null), assert(genres != null), assert(homepage != null), assert(id != null), assert(name != null), assert(numberOfEpisodes != null), assert(numberOfSeasons != null), assert(overview != null), assert(posterPath != null), assert(type != null), assert(voteAverage != null), assert(contentRatings != null), assert(videos != null), super._(); factory _$_Serie.fromJson(Map<String, dynamic> json) => _$_$_SerieFromJson(json); @override final DateTime firstAirDate; @override final List<Genre> genres; @override final String homepage; @override final int id; @override final String name; @override final int numberOfEpisodes; @override final int numberOfSeasons; @override final String overview; @override final String posterPath; @override final String type; @override final double voteAverage; @override final ContentRatings contentRatings; @override final Videos videos; @override String toString() { return 'Serie(firstAirDate: $firstAirDate, genres: $genres, homepage: $homepage, id: $id, name: $name, numberOfEpisodes: $numberOfEpisodes, numberOfSeasons: $numberOfSeasons, overview: $overview, posterPath: $posterPath, type: $type, voteAverage: $voteAverage, contentRatings: $contentRatings, videos: $videos)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Serie && (identical(other.firstAirDate, firstAirDate) || const DeepCollectionEquality() .equals(other.firstAirDate, firstAirDate)) && (identical(other.genres, genres) || const DeepCollectionEquality().equals(other.genres, genres)) && (identical(other.homepage, homepage) || const DeepCollectionEquality() .equals(other.homepage, homepage)) && (identical(other.id, id) || const DeepCollectionEquality().equals(other.id, id)) && (identical(other.name, name) || const DeepCollectionEquality().equals(other.name, name)) && (identical(other.numberOfEpisodes, numberOfEpisodes) || const DeepCollectionEquality() .equals(other.numberOfEpisodes, numberOfEpisodes)) && (identical(other.numberOfSeasons, numberOfSeasons) || const DeepCollectionEquality() .equals(other.numberOfSeasons, numberOfSeasons)) && (identical(other.overview, overview) || const DeepCollectionEquality() .equals(other.overview, overview)) && (identical(other.posterPath, posterPath) || const DeepCollectionEquality() .equals(other.posterPath, posterPath)) && (identical(other.type, type) || const DeepCollectionEquality().equals(other.type, type)) && (identical(other.voteAverage, voteAverage) || const DeepCollectionEquality() .equals(other.voteAverage, voteAverage)) && (identical(other.contentRatings, contentRatings) || const DeepCollectionEquality() .equals(other.contentRatings, contentRatings)) && (identical(other.videos, videos) || const DeepCollectionEquality().equals(other.videos, videos))); } @override int get hashCode => runtimeType.hashCode ^ const DeepCollectionEquality().hash(firstAirDate) ^ const DeepCollectionEquality().hash(genres) ^ const DeepCollectionEquality().hash(homepage) ^ const DeepCollectionEquality().hash(id) ^ const DeepCollectionEquality().hash(name) ^ const DeepCollectionEquality().hash(numberOfEpisodes) ^ const DeepCollectionEquality().hash(numberOfSeasons) ^ const DeepCollectionEquality().hash(overview) ^ const DeepCollectionEquality().hash(posterPath) ^ const DeepCollectionEquality().hash(type) ^ const DeepCollectionEquality().hash(voteAverage) ^ const DeepCollectionEquality().hash(contentRatings) ^ const DeepCollectionEquality().hash(videos); @override _$SerieCopyWith<_Serie> get copyWith => __$SerieCopyWithImpl<_Serie>(this, _$identity); @override Map<String, dynamic> toJson() { return _$_$_SerieToJson(this); } } abstract class _Serie extends Serie { const _Serie._() : super._(); const factory _Serie( {@required DateTime firstAirDate, @required List<Genre> genres, @required String homepage, @required int id, @required String name, @required int numberOfEpisodes, @required int numberOfSeasons, @required String overview, @required String posterPath, @required String type, @required double voteAverage, @required ContentRatings contentRatings, @required Videos videos}) = _$_Serie; factory _Serie.fromJson(Map<String, dynamic> json) = _$_Serie.fromJson; @override DateTime get firstAirDate; @override List<Genre> get genres; @override String get homepage; @override int get id; @override String get name; @override int get numberOfEpisodes; @override int get numberOfSeasons; @override String get overview; @override String get posterPath; @override String get type; @override double get voteAverage; @override ContentRatings get contentRatings; @override Videos get videos; @override _$SerieCopyWith<_Serie> get copyWith; }
0
mirrored_repositories/movingPictures/lib/domain/home/series
mirrored_repositories/movingPictures/lib/domain/home/series/serie/content_ratings.dart
import 'package:flutter/foundation.dart'; class ContentRatings { ContentRatings({ @required this.results, }); final List<ContentRatingsResult> results; factory ContentRatings.fromJson(Map<String, dynamic> json) => ContentRatings( results: List<ContentRatingsResult>.from(json["results"].map( (x) => ContentRatingsResult.fromJson(x as Map<String, dynamic>)) as Iterable), ); Map<String, dynamic> toJson() => { "results": List<dynamic>.from(results.map((x) => x.toJson())), }; } class ContentRatingsResult { ContentRatingsResult({ @required this.iso31661, @required this.rating, }); final String iso31661; final String rating; factory ContentRatingsResult.fromJson(Map<String, dynamic> json) => ContentRatingsResult( iso31661: json["iso_3166_1"] as String, rating: json["rating"] as String, ); Map<String, dynamic> toJson() => { "iso_3166_1": iso31661, "rating": rating, }; }
0
mirrored_repositories/movingPictures/lib/domain/home/series
mirrored_repositories/movingPictures/lib/domain/home/series/serie/serie.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'serie.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** _$_Serie _$_$_SerieFromJson(Map<String, dynamic> json) { return _$_Serie( firstAirDate: json['firstAirDate'] == null ? null : DateTime.parse(json['firstAirDate'] as String), genres: (json['genres'] as List) ?.map( (e) => e == null ? null : Genre.fromJson(e as Map<String, dynamic>)) ?.toList(), homepage: json['homepage'] as String, id: json['id'] as int, name: json['name'] as String, numberOfEpisodes: json['numberOfEpisodes'] as int, numberOfSeasons: json['numberOfSeasons'] as int, overview: json['overview'] as String, posterPath: json['posterPath'] as String, type: json['type'] as String, voteAverage: (json['voteAverage'] as num)?.toDouble(), contentRatings: json['contentRatings'] == null ? null : ContentRatings.fromJson( json['contentRatings'] as Map<String, dynamic>), videos: json['videos'] == null ? null : Videos.fromJson(json['videos'] as Map<String, dynamic>), ); } Map<String, dynamic> _$_$_SerieToJson(_$_Serie instance) => <String, dynamic>{ 'firstAirDate': instance.firstAirDate?.toIso8601String(), 'genres': instance.genres?.map((e) => e?.toJson())?.toList(), 'homepage': instance.homepage, 'id': instance.id, 'name': instance.name, 'numberOfEpisodes': instance.numberOfEpisodes, 'numberOfSeasons': instance.numberOfSeasons, 'overview': instance.overview, 'posterPath': instance.posterPath, 'type': instance.type, 'voteAverage': instance.voteAverage, 'contentRatings': instance.contentRatings?.toJson(), 'videos': instance.videos?.toJson(), };
0
mirrored_repositories/movingPictures/lib/domain/home/series
mirrored_repositories/movingPictures/lib/domain/home/series/serie/serie.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import '../../shared_classes/genres/genre.dart'; import '../../shared_classes/videos.dart'; import 'content_ratings.dart'; part 'serie.freezed.dart'; part 'serie.g.dart'; @freezed abstract class Serie with _$Serie { const factory Serie({ @required DateTime firstAirDate, @required List<Genre> genres, @required String homepage, @required int id, @required String name, @required int numberOfEpisodes, @required int numberOfSeasons, @required String overview, @required String posterPath, @required String type, @required double voteAverage, @required ContentRatings contentRatings, @required Videos videos, }) = _Serie; const Serie._() : super(); factory Serie.fromJson(Map<String, dynamic> json) => Serie( firstAirDate: DateTime.parse(json["first_air_date"] as String), genres: List<Genre>.from(json["genres"] .map((x) => Genre.fromJson(x as Map<String, dynamic>)) as Iterable), homepage: json["homepage"] as String, id: json["id"] as int, name: json["name"] as String, numberOfEpisodes: json["number_of_episodes"] as int, numberOfSeasons: json["number_of_seasons"] as int, overview: json["overview"] as String, posterPath: json["poster_path"] as String, type: json["type"] as String, voteAverage: json["vote_average"].toDouble() as double, contentRatings: ContentRatings.fromJson( json["content_ratings"] as Map<String, dynamic>), videos: Videos.fromJson(json["videos"] as Map<String, dynamic>), ); @override Map<String, dynamic> toJson() => { "first_air_date": firstAirDate, "genres": genres, "homepage": homepage, "id": id, "name": name, "number_of_episodes": numberOfEpisodes, "number_of_seasons": numberOfSeasons, "overview": overview, "poster_path": posterPath, "type": type, "vote_average": voteAverage, "content_ratings": contentRatings.toJson(), "videos": videos.toJson(), }; factory Serie.fromFirebase(DocumentSnapshot doc) => Serie.fromJson(doc.data()); }
0
mirrored_repositories/movingPictures/lib/domain/home/series
mirrored_repositories/movingPictures/lib/domain/home/series/serie/serie_failure.dart
import 'package:freezed_annotation/freezed_annotation.dart'; part 'serie_failure.freezed.dart'; @freezed abstract class SerieFailure with _$SerieFailure { const factory SerieFailure.unexpected() = _Unexpected; const factory SerieFailure.noInternetConnection() = _NoInternetConnection; const factory SerieFailure.unableToAdd() = _UnableToAdd; const factory SerieFailure.insufficientPermissions() = _InsufficientPermissions; }
0
mirrored_repositories/movingPictures/lib/domain/home/series
mirrored_repositories/movingPictures/lib/domain/home/series/serie/serie_failure.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'serie_failure.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; /// @nodoc class _$SerieFailureTearOff { const _$SerieFailureTearOff(); // ignore: unused_element _Unexpected unexpected() { return const _Unexpected(); } // ignore: unused_element _NoInternetConnection noInternetConnection() { return const _NoInternetConnection(); } // ignore: unused_element _UnableToAdd unableToAdd() { return const _UnableToAdd(); } // ignore: unused_element _InsufficientPermissions insufficientPermissions() { return const _InsufficientPermissions(); } } /// @nodoc // ignore: unused_element const $SerieFailure = _$SerieFailureTearOff(); /// @nodoc mixin _$SerieFailure { @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }); @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }); @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }); @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }); } /// @nodoc abstract class $SerieFailureCopyWith<$Res> { factory $SerieFailureCopyWith( SerieFailure value, $Res Function(SerieFailure) then) = _$SerieFailureCopyWithImpl<$Res>; } /// @nodoc class _$SerieFailureCopyWithImpl<$Res> implements $SerieFailureCopyWith<$Res> { _$SerieFailureCopyWithImpl(this._value, this._then); final SerieFailure _value; // ignore: unused_field final $Res Function(SerieFailure) _then; } /// @nodoc abstract class _$UnexpectedCopyWith<$Res> { factory _$UnexpectedCopyWith( _Unexpected value, $Res Function(_Unexpected) then) = __$UnexpectedCopyWithImpl<$Res>; } /// @nodoc class __$UnexpectedCopyWithImpl<$Res> extends _$SerieFailureCopyWithImpl<$Res> implements _$UnexpectedCopyWith<$Res> { __$UnexpectedCopyWithImpl( _Unexpected _value, $Res Function(_Unexpected) _then) : super(_value, (v) => _then(v as _Unexpected)); @override _Unexpected get _value => super._value as _Unexpected; } /// @nodoc class _$_Unexpected implements _Unexpected { const _$_Unexpected(); @override String toString() { return 'SerieFailure.unexpected()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Unexpected); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unexpected(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unexpected(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(this); } return orElse(); } } abstract class _Unexpected implements SerieFailure { const factory _Unexpected() = _$_Unexpected; } /// @nodoc abstract class _$NoInternetConnectionCopyWith<$Res> { factory _$NoInternetConnectionCopyWith(_NoInternetConnection value, $Res Function(_NoInternetConnection) then) = __$NoInternetConnectionCopyWithImpl<$Res>; } /// @nodoc class __$NoInternetConnectionCopyWithImpl<$Res> extends _$SerieFailureCopyWithImpl<$Res> implements _$NoInternetConnectionCopyWith<$Res> { __$NoInternetConnectionCopyWithImpl( _NoInternetConnection _value, $Res Function(_NoInternetConnection) _then) : super(_value, (v) => _then(v as _NoInternetConnection)); @override _NoInternetConnection get _value => super._value as _NoInternetConnection; } /// @nodoc class _$_NoInternetConnection implements _NoInternetConnection { const _$_NoInternetConnection(); @override String toString() { return 'SerieFailure.noInternetConnection()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _NoInternetConnection); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return noInternetConnection(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (noInternetConnection != null) { return noInternetConnection(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return noInternetConnection(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (noInternetConnection != null) { return noInternetConnection(this); } return orElse(); } } abstract class _NoInternetConnection implements SerieFailure { const factory _NoInternetConnection() = _$_NoInternetConnection; } /// @nodoc abstract class _$UnableToAddCopyWith<$Res> { factory _$UnableToAddCopyWith( _UnableToAdd value, $Res Function(_UnableToAdd) then) = __$UnableToAddCopyWithImpl<$Res>; } /// @nodoc class __$UnableToAddCopyWithImpl<$Res> extends _$SerieFailureCopyWithImpl<$Res> implements _$UnableToAddCopyWith<$Res> { __$UnableToAddCopyWithImpl( _UnableToAdd _value, $Res Function(_UnableToAdd) _then) : super(_value, (v) => _then(v as _UnableToAdd)); @override _UnableToAdd get _value => super._value as _UnableToAdd; } /// @nodoc class _$_UnableToAdd implements _UnableToAdd { const _$_UnableToAdd(); @override String toString() { return 'SerieFailure.unableToAdd()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _UnableToAdd); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unableToAdd(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (unableToAdd != null) { return unableToAdd(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unableToAdd(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (unableToAdd != null) { return unableToAdd(this); } return orElse(); } } abstract class _UnableToAdd implements SerieFailure { const factory _UnableToAdd() = _$_UnableToAdd; } /// @nodoc abstract class _$InsufficientPermissionsCopyWith<$Res> { factory _$InsufficientPermissionsCopyWith(_InsufficientPermissions value, $Res Function(_InsufficientPermissions) then) = __$InsufficientPermissionsCopyWithImpl<$Res>; } /// @nodoc class __$InsufficientPermissionsCopyWithImpl<$Res> extends _$SerieFailureCopyWithImpl<$Res> implements _$InsufficientPermissionsCopyWith<$Res> { __$InsufficientPermissionsCopyWithImpl(_InsufficientPermissions _value, $Res Function(_InsufficientPermissions) _then) : super(_value, (v) => _then(v as _InsufficientPermissions)); @override _InsufficientPermissions get _value => super._value as _InsufficientPermissions; } /// @nodoc class _$_InsufficientPermissions implements _InsufficientPermissions { const _$_InsufficientPermissions(); @override String toString() { return 'SerieFailure.insufficientPermissions()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _InsufficientPermissions); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return insufficientPermissions(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (insufficientPermissions != null) { return insufficientPermissions(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return insufficientPermissions(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (insufficientPermissions != null) { return insufficientPermissions(this); } return orElse(); } } abstract class _InsufficientPermissions implements SerieFailure { const factory _InsufficientPermissions() = _$_InsufficientPermissions; }
0
mirrored_repositories/movingPictures/lib/domain/home/series
mirrored_repositories/movingPictures/lib/domain/home/series/serie_sub/serie_sub.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'serie_sub.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; /// @nodoc class _$SerieSubTearOff { const _$SerieSubTearOff(); // ignore: unused_element _SerieSub call( {@required int id, @required String name, @required String posterPath}) { return _SerieSub( id: id, name: name, posterPath: posterPath, ); } } /// @nodoc // ignore: unused_element const $SerieSub = _$SerieSubTearOff(); /// @nodoc mixin _$SerieSub { int get id; String get name; String get posterPath; $SerieSubCopyWith<SerieSub> get copyWith; } /// @nodoc abstract class $SerieSubCopyWith<$Res> { factory $SerieSubCopyWith(SerieSub value, $Res Function(SerieSub) then) = _$SerieSubCopyWithImpl<$Res>; $Res call({int id, String name, String posterPath}); } /// @nodoc class _$SerieSubCopyWithImpl<$Res> implements $SerieSubCopyWith<$Res> { _$SerieSubCopyWithImpl(this._value, this._then); final SerieSub _value; // ignore: unused_field final $Res Function(SerieSub) _then; @override $Res call({ Object id = freezed, Object name = freezed, Object posterPath = freezed, }) { return _then(_value.copyWith( id: id == freezed ? _value.id : id as int, name: name == freezed ? _value.name : name as String, posterPath: posterPath == freezed ? _value.posterPath : posterPath as String, )); } } /// @nodoc abstract class _$SerieSubCopyWith<$Res> implements $SerieSubCopyWith<$Res> { factory _$SerieSubCopyWith(_SerieSub value, $Res Function(_SerieSub) then) = __$SerieSubCopyWithImpl<$Res>; @override $Res call({int id, String name, String posterPath}); } /// @nodoc class __$SerieSubCopyWithImpl<$Res> extends _$SerieSubCopyWithImpl<$Res> implements _$SerieSubCopyWith<$Res> { __$SerieSubCopyWithImpl(_SerieSub _value, $Res Function(_SerieSub) _then) : super(_value, (v) => _then(v as _SerieSub)); @override _SerieSub get _value => super._value as _SerieSub; @override $Res call({ Object id = freezed, Object name = freezed, Object posterPath = freezed, }) { return _then(_SerieSub( id: id == freezed ? _value.id : id as int, name: name == freezed ? _value.name : name as String, posterPath: posterPath == freezed ? _value.posterPath : posterPath as String, )); } } /// @nodoc class _$_SerieSub extends _SerieSub { const _$_SerieSub( {@required this.id, @required this.name, @required this.posterPath}) : assert(id != null), assert(name != null), assert(posterPath != null), super._(); @override final int id; @override final String name; @override final String posterPath; @override String toString() { return 'SerieSub(id: $id, name: $name, posterPath: $posterPath)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _SerieSub && (identical(other.id, id) || const DeepCollectionEquality().equals(other.id, id)) && (identical(other.name, name) || const DeepCollectionEquality().equals(other.name, name)) && (identical(other.posterPath, posterPath) || const DeepCollectionEquality() .equals(other.posterPath, posterPath))); } @override int get hashCode => runtimeType.hashCode ^ const DeepCollectionEquality().hash(id) ^ const DeepCollectionEquality().hash(name) ^ const DeepCollectionEquality().hash(posterPath); @override _$SerieSubCopyWith<_SerieSub> get copyWith => __$SerieSubCopyWithImpl<_SerieSub>(this, _$identity); } abstract class _SerieSub extends SerieSub { const _SerieSub._() : super._(); const factory _SerieSub( {@required int id, @required String name, @required String posterPath}) = _$_SerieSub; @override int get id; @override String get name; @override String get posterPath; @override _$SerieSubCopyWith<_SerieSub> get copyWith; }
0
mirrored_repositories/movingPictures/lib/domain/home/series
mirrored_repositories/movingPictures/lib/domain/home/series/serie_sub/serie_sub.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'serie_sub.freezed.dart'; @freezed abstract class SerieSub implements _$SerieSub { const factory SerieSub({ @required int id, @required String name, @required String posterPath, }) = _SerieSub; const SerieSub._(); factory SerieSub.fromJsonData(Map<String, dynamic> json) => SerieSub( id: json['id'] as int ?? 0, name: json['name'] as String ?? "n/a", posterPath: json['poster_path'] as String ?? "", ); Map<String, dynamic> toJson() => { "id": id, "name": name, "poster_path": posterPath, }; factory SerieSub.fromFirebase(DocumentSnapshot doc) => SerieSub.fromJsonData(doc.data()); }
0
mirrored_repositories/movingPictures/lib/domain/home
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/videos.dart
import 'package:flutter/foundation.dart'; class Videos { Videos({ @required this.results, }); final List<Result> results; factory Videos.fromJson(Map<String, dynamic> json) => Videos( results: List<Result>.from( json["results"].map( (x) => Result.fromJson(x as Map<String, dynamic>), ) as Iterable, ), ); Map<String, dynamic> toJson() => { "results": List<dynamic>.from(results.map((x) => x.toJson())), }; } class Result { Result({ @required this.id, @required this.key, @required this.name, @required this.site, @required this.type, }); final String id; final String key; final String name; final String site; final String type; factory Result.fromJson(Map<String, dynamic> json) => Result( id: json["id"] as String, key: json["key"] as String, name: json["name"] as String, site: json["site"] as String, type: json["type"] as String, ); Map<String, dynamic> toJson() => { "id": id, "key": key, "name": name, "site": site, "type": type, }; }
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/cast/cast.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'cast.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** _$_Cast _$_$_CastFromJson(Map<String, dynamic> json) { return _$_Cast( id: json['id'] as int, name: json['name'] as String, profilePath: json['profilePath'] as String, ); } Map<String, dynamic> _$_$_CastToJson(_$_Cast instance) => <String, dynamic>{ 'id': instance.id, 'name': instance.name, 'profilePath': instance.profilePath, };
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/cast/cast.dart
import 'package:freezed_annotation/freezed_annotation.dart'; part 'cast.freezed.dart'; part 'cast.g.dart'; @freezed abstract class Cast with _$Cast { const factory Cast({ @required int id, @required String name, @required String profilePath, }) = _Cast; const Cast._(); factory Cast.fromJson(Map<String, dynamic> json) => Cast( id: json['id'] as int ?? 0, name: json['name'] as String ?? "", profilePath: json['profile_path'] as String ?? ""); }
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/cast/cast_interface.dart
import 'package:dartz/dartz.dart'; import 'cast.dart'; import 'cast_failure.dart'; abstract class CastInterface { Future<Either<CastFailure, Cast>> getPerson(int castId); }
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/cast/cast_failure.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'cast_failure.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; /// @nodoc class _$CastFailureTearOff { const _$CastFailureTearOff(); // ignore: unused_element _Unexpected unexpected() { return const _Unexpected(); } } /// @nodoc // ignore: unused_element const $CastFailure = _$CastFailureTearOff(); /// @nodoc mixin _$CastFailure { @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), }); @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), @required Result orElse(), }); @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), }); @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), @required Result orElse(), }); } /// @nodoc abstract class $CastFailureCopyWith<$Res> { factory $CastFailureCopyWith( CastFailure value, $Res Function(CastFailure) then) = _$CastFailureCopyWithImpl<$Res>; } /// @nodoc class _$CastFailureCopyWithImpl<$Res> implements $CastFailureCopyWith<$Res> { _$CastFailureCopyWithImpl(this._value, this._then); final CastFailure _value; // ignore: unused_field final $Res Function(CastFailure) _then; } /// @nodoc abstract class _$UnexpectedCopyWith<$Res> { factory _$UnexpectedCopyWith( _Unexpected value, $Res Function(_Unexpected) then) = __$UnexpectedCopyWithImpl<$Res>; } /// @nodoc class __$UnexpectedCopyWithImpl<$Res> extends _$CastFailureCopyWithImpl<$Res> implements _$UnexpectedCopyWith<$Res> { __$UnexpectedCopyWithImpl( _Unexpected _value, $Res Function(_Unexpected) _then) : super(_value, (v) => _then(v as _Unexpected)); @override _Unexpected get _value => super._value as _Unexpected; } /// @nodoc class _$_Unexpected implements _Unexpected { const _$_Unexpected(); @override String toString() { return 'CastFailure.unexpected()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Unexpected); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), }) { assert(unexpected != null); return unexpected(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), }) { assert(unexpected != null); return unexpected(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(this); } return orElse(); } } abstract class _Unexpected implements CastFailure { const factory _Unexpected() = _$_Unexpected; }
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/cast/cast.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'cast.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; Cast _$CastFromJson(Map<String, dynamic> json) { return _Cast.fromJson(json); } /// @nodoc class _$CastTearOff { const _$CastTearOff(); // ignore: unused_element _Cast call( {@required int id, @required String name, @required String profilePath}) { return _Cast( id: id, name: name, profilePath: profilePath, ); } // ignore: unused_element Cast fromJson(Map<String, Object> json) { return Cast.fromJson(json); } } /// @nodoc // ignore: unused_element const $Cast = _$CastTearOff(); /// @nodoc mixin _$Cast { int get id; String get name; String get profilePath; Map<String, dynamic> toJson(); $CastCopyWith<Cast> get copyWith; } /// @nodoc abstract class $CastCopyWith<$Res> { factory $CastCopyWith(Cast value, $Res Function(Cast) then) = _$CastCopyWithImpl<$Res>; $Res call({int id, String name, String profilePath}); } /// @nodoc class _$CastCopyWithImpl<$Res> implements $CastCopyWith<$Res> { _$CastCopyWithImpl(this._value, this._then); final Cast _value; // ignore: unused_field final $Res Function(Cast) _then; @override $Res call({ Object id = freezed, Object name = freezed, Object profilePath = freezed, }) { return _then(_value.copyWith( id: id == freezed ? _value.id : id as int, name: name == freezed ? _value.name : name as String, profilePath: profilePath == freezed ? _value.profilePath : profilePath as String, )); } } /// @nodoc abstract class _$CastCopyWith<$Res> implements $CastCopyWith<$Res> { factory _$CastCopyWith(_Cast value, $Res Function(_Cast) then) = __$CastCopyWithImpl<$Res>; @override $Res call({int id, String name, String profilePath}); } /// @nodoc class __$CastCopyWithImpl<$Res> extends _$CastCopyWithImpl<$Res> implements _$CastCopyWith<$Res> { __$CastCopyWithImpl(_Cast _value, $Res Function(_Cast) _then) : super(_value, (v) => _then(v as _Cast)); @override _Cast get _value => super._value as _Cast; @override $Res call({ Object id = freezed, Object name = freezed, Object profilePath = freezed, }) { return _then(_Cast( id: id == freezed ? _value.id : id as int, name: name == freezed ? _value.name : name as String, profilePath: profilePath == freezed ? _value.profilePath : profilePath as String, )); } } @JsonSerializable() /// @nodoc class _$_Cast extends _Cast { const _$_Cast( {@required this.id, @required this.name, @required this.profilePath}) : assert(id != null), assert(name != null), assert(profilePath != null), super._(); factory _$_Cast.fromJson(Map<String, dynamic> json) => _$_$_CastFromJson(json); @override final int id; @override final String name; @override final String profilePath; @override String toString() { return 'Cast(id: $id, name: $name, profilePath: $profilePath)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Cast && (identical(other.id, id) || const DeepCollectionEquality().equals(other.id, id)) && (identical(other.name, name) || const DeepCollectionEquality().equals(other.name, name)) && (identical(other.profilePath, profilePath) || const DeepCollectionEquality() .equals(other.profilePath, profilePath))); } @override int get hashCode => runtimeType.hashCode ^ const DeepCollectionEquality().hash(id) ^ const DeepCollectionEquality().hash(name) ^ const DeepCollectionEquality().hash(profilePath); @override _$CastCopyWith<_Cast> get copyWith => __$CastCopyWithImpl<_Cast>(this, _$identity); @override Map<String, dynamic> toJson() { return _$_$_CastToJson(this); } } abstract class _Cast extends Cast { const _Cast._() : super._(); const factory _Cast( {@required int id, @required String name, @required String profilePath}) = _$_Cast; factory _Cast.fromJson(Map<String, dynamic> json) = _$_Cast.fromJson; @override int get id; @override String get name; @override String get profilePath; @override _$CastCopyWith<_Cast> get copyWith; }
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/cast/cast_failure.dart
import 'package:freezed_annotation/freezed_annotation.dart'; part 'cast_failure.freezed.dart'; @freezed abstract class CastFailure with _$CastFailure { const factory CastFailure.unexpected() = _Unexpected; }
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/genres/genre.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'genre.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** _$_Genre _$_$_GenreFromJson(Map<String, dynamic> json) { return _$_Genre( id: json['id'] as int, name: json['name'] as String, ); } Map<String, dynamic> _$_$_GenreToJson(_$_Genre instance) => <String, dynamic>{ 'id': instance.id, 'name': instance.name, };
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/genres/genre_failure.dart
import 'package:freezed_annotation/freezed_annotation.dart'; part 'genre_failure.freezed.dart'; @freezed abstract class GenreFailure with _$GenreFailure { const factory GenreFailure.unexpected() = _Unexpected; const factory GenreFailure.noInternetConnection() = _NoInternetConnection; }
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/genres/genre.dart
import 'package:freezed_annotation/freezed_annotation.dart'; part 'genre.freezed.dart'; part 'genre.g.dart'; @freezed abstract class Genre with _$Genre { const factory Genre({ @required int id, @required String name, }) = _Genre; const Genre._(); Genre toDomain() { return Genre( id: id, name: name, ); } factory Genre.fromJson(Map<String, dynamic> json) => _$GenreFromJson(json); }
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/genres/genre_failure.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'genre_failure.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; /// @nodoc class _$GenreFailureTearOff { const _$GenreFailureTearOff(); // ignore: unused_element _Unexpected unexpected() { return const _Unexpected(); } // ignore: unused_element _NoInternetConnection noInternetConnection() { return const _NoInternetConnection(); } } /// @nodoc // ignore: unused_element const $GenreFailure = _$GenreFailureTearOff(); /// @nodoc mixin _$GenreFailure { @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), }); @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), @required Result orElse(), }); @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), }); @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), @required Result orElse(), }); } /// @nodoc abstract class $GenreFailureCopyWith<$Res> { factory $GenreFailureCopyWith( GenreFailure value, $Res Function(GenreFailure) then) = _$GenreFailureCopyWithImpl<$Res>; } /// @nodoc class _$GenreFailureCopyWithImpl<$Res> implements $GenreFailureCopyWith<$Res> { _$GenreFailureCopyWithImpl(this._value, this._then); final GenreFailure _value; // ignore: unused_field final $Res Function(GenreFailure) _then; } /// @nodoc abstract class _$UnexpectedCopyWith<$Res> { factory _$UnexpectedCopyWith( _Unexpected value, $Res Function(_Unexpected) then) = __$UnexpectedCopyWithImpl<$Res>; } /// @nodoc class __$UnexpectedCopyWithImpl<$Res> extends _$GenreFailureCopyWithImpl<$Res> implements _$UnexpectedCopyWith<$Res> { __$UnexpectedCopyWithImpl( _Unexpected _value, $Res Function(_Unexpected) _then) : super(_value, (v) => _then(v as _Unexpected)); @override _Unexpected get _value => super._value as _Unexpected; } /// @nodoc class _$_Unexpected implements _Unexpected { const _$_Unexpected(); @override String toString() { return 'GenreFailure.unexpected()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Unexpected); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), }) { assert(unexpected != null); assert(noInternetConnection != null); return unexpected(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), }) { assert(unexpected != null); assert(noInternetConnection != null); return unexpected(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(this); } return orElse(); } } abstract class _Unexpected implements GenreFailure { const factory _Unexpected() = _$_Unexpected; } /// @nodoc abstract class _$NoInternetConnectionCopyWith<$Res> { factory _$NoInternetConnectionCopyWith(_NoInternetConnection value, $Res Function(_NoInternetConnection) then) = __$NoInternetConnectionCopyWithImpl<$Res>; } /// @nodoc class __$NoInternetConnectionCopyWithImpl<$Res> extends _$GenreFailureCopyWithImpl<$Res> implements _$NoInternetConnectionCopyWith<$Res> { __$NoInternetConnectionCopyWithImpl( _NoInternetConnection _value, $Res Function(_NoInternetConnection) _then) : super(_value, (v) => _then(v as _NoInternetConnection)); @override _NoInternetConnection get _value => super._value as _NoInternetConnection; } /// @nodoc class _$_NoInternetConnection implements _NoInternetConnection { const _$_NoInternetConnection(); @override String toString() { return 'GenreFailure.noInternetConnection()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _NoInternetConnection); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), }) { assert(unexpected != null); assert(noInternetConnection != null); return noInternetConnection(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), @required Result orElse(), }) { assert(orElse != null); if (noInternetConnection != null) { return noInternetConnection(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), }) { assert(unexpected != null); assert(noInternetConnection != null); return noInternetConnection(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), @required Result orElse(), }) { assert(orElse != null); if (noInternetConnection != null) { return noInternetConnection(this); } return orElse(); } } abstract class _NoInternetConnection implements GenreFailure { const factory _NoInternetConnection() = _$_NoInternetConnection; }
0
mirrored_repositories/movingPictures/lib/domain/home/shared_classes
mirrored_repositories/movingPictures/lib/domain/home/shared_classes/genres/genre.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'genre.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; Genre _$GenreFromJson(Map<String, dynamic> json) { return _Genre.fromJson(json); } /// @nodoc class _$GenreTearOff { const _$GenreTearOff(); // ignore: unused_element _Genre call({@required int id, @required String name}) { return _Genre( id: id, name: name, ); } // ignore: unused_element Genre fromJson(Map<String, Object> json) { return Genre.fromJson(json); } } /// @nodoc // ignore: unused_element const $Genre = _$GenreTearOff(); /// @nodoc mixin _$Genre { int get id; String get name; Map<String, dynamic> toJson(); $GenreCopyWith<Genre> get copyWith; } /// @nodoc abstract class $GenreCopyWith<$Res> { factory $GenreCopyWith(Genre value, $Res Function(Genre) then) = _$GenreCopyWithImpl<$Res>; $Res call({int id, String name}); } /// @nodoc class _$GenreCopyWithImpl<$Res> implements $GenreCopyWith<$Res> { _$GenreCopyWithImpl(this._value, this._then); final Genre _value; // ignore: unused_field final $Res Function(Genre) _then; @override $Res call({ Object id = freezed, Object name = freezed, }) { return _then(_value.copyWith( id: id == freezed ? _value.id : id as int, name: name == freezed ? _value.name : name as String, )); } } /// @nodoc abstract class _$GenreCopyWith<$Res> implements $GenreCopyWith<$Res> { factory _$GenreCopyWith(_Genre value, $Res Function(_Genre) then) = __$GenreCopyWithImpl<$Res>; @override $Res call({int id, String name}); } /// @nodoc class __$GenreCopyWithImpl<$Res> extends _$GenreCopyWithImpl<$Res> implements _$GenreCopyWith<$Res> { __$GenreCopyWithImpl(_Genre _value, $Res Function(_Genre) _then) : super(_value, (v) => _then(v as _Genre)); @override _Genre get _value => super._value as _Genre; @override $Res call({ Object id = freezed, Object name = freezed, }) { return _then(_Genre( id: id == freezed ? _value.id : id as int, name: name == freezed ? _value.name : name as String, )); } } @JsonSerializable() /// @nodoc class _$_Genre extends _Genre { const _$_Genre({@required this.id, @required this.name}) : assert(id != null), assert(name != null), super._(); factory _$_Genre.fromJson(Map<String, dynamic> json) => _$_$_GenreFromJson(json); @override final int id; @override final String name; @override String toString() { return 'Genre(id: $id, name: $name)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Genre && (identical(other.id, id) || const DeepCollectionEquality().equals(other.id, id)) && (identical(other.name, name) || const DeepCollectionEquality().equals(other.name, name))); } @override int get hashCode => runtimeType.hashCode ^ const DeepCollectionEquality().hash(id) ^ const DeepCollectionEquality().hash(name); @override _$GenreCopyWith<_Genre> get copyWith => __$GenreCopyWithImpl<_Genre>(this, _$identity); @override Map<String, dynamic> toJson() { return _$_$_GenreToJson(this); } } abstract class _Genre extends Genre { const _Genre._() : super._(); const factory _Genre({@required int id, @required String name}) = _$_Genre; factory _Genre.fromJson(Map<String, dynamic> json) = _$_Genre.fromJson; @override int get id; @override String get name; @override _$GenreCopyWith<_Genre> get copyWith; }
0
mirrored_repositories/movingPictures/lib/domain/home
mirrored_repositories/movingPictures/lib/domain/home/movies/favorite_movies_interface.dart
import 'package:dartz/dartz.dart'; import 'favorite_movies/favorite_movies.dart'; import 'movie/movies_failure.dart'; abstract class FavoriteMoviesInterface { Stream<Either<MovieFailure, List<FavoriteMovie>>> watchMovieFavorites(); Future<Either<MovieFailure, Unit>> createFavoriteMovie(int movieId); Future<Either<MovieFailure, Unit>> deleteFavoriteMovie(int movieId); }
0
mirrored_repositories/movingPictures/lib/domain/home
mirrored_repositories/movingPictures/lib/domain/home/movies/movies_interface.dart
import 'package:dartz/dartz.dart'; import '../shared_classes/cast/cast.dart'; import '../shared_classes/cast/cast_failure.dart'; import '../shared_classes/genres/genre.dart'; import '../shared_classes/genres/genre_failure.dart'; import 'movie/movie.dart'; import 'movie/movies_failure.dart'; import 'movie_sub/movie_sub.dart'; abstract class MoviesInterface { Future<Either<MovieFailure, Movie>> getMovie(int movieId); Future<Either<MovieFailure, List<MovieSub>>> getMovieListType( String movieListType); Future<Either<MovieFailure, List<MovieSub>>> getSimilarMovies(int movieId); Future<Either<GenreFailure, List<Genre>>> getGenres(); Future<Either<MovieFailure, List<MovieSub>>> getMovieByGenre( int movieGenreId); Future<Either<CastFailure, List<Cast>>> getCast(int movieId); Future<Either<MovieFailure, List<MovieSub>>> getMovieByCastId(int castId); }
0
mirrored_repositories/movingPictures/lib/domain/home/movies
mirrored_repositories/movingPictures/lib/domain/home/movies/movie/release_dates.dart
import 'package:flutter/foundation.dart'; class ReleaseDates { ReleaseDates({ @required this.results, }); final List<Result> results; factory ReleaseDates.fromJson(Map<String, dynamic> json) => ReleaseDates( results: List<Result>.from( json["results"].map( (x) => Result.fromJson(x as Map<String, dynamic>), ) as Iterable<dynamic>, ), ); Map<String, dynamic> toJson() => { "results": List<dynamic>.from(results.map((x) => x.toJson())), }; } class Result { Result({ @required this.releaseDates, @required this.iso31661, }); final List<ReleaseDate> releaseDates; final String iso31661; factory Result.fromJson(Map<String, dynamic> json) => Result( iso31661: json["iso_3166_1"] as String, releaseDates: List<ReleaseDate>.from( json["release_dates"].map( (x) => ReleaseDate.fromJson(x as Map<String, dynamic>), ) as Iterable<dynamic>, ), ); Map<String, dynamic> toJson() => { "iso_3166_1": iso31661, "release_dates": List<dynamic>.from(releaseDates.map((x) => x.toJson())), }; } class ReleaseDate { ReleaseDate({ @required this.certification, }); final String certification; factory ReleaseDate.fromJson(Map<String, dynamic> json) => ReleaseDate( certification: json["certification"] as String, ); Map<String, dynamic> toJson() => { "certification": certification, }; }
0
mirrored_repositories/movingPictures/lib/domain/home/movies
mirrored_repositories/movingPictures/lib/domain/home/movies/movie/movie.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:meta/meta.dart'; import '../../shared_classes/genres/genre.dart'; import '../../shared_classes/videos.dart'; import 'release_dates.dart'; part 'movie.freezed.dart'; part 'movie.g.dart'; @freezed abstract class Movie implements _$Movie { const factory Movie({ @required int id, @required String title, @required String posterPath, @required String overview, @required String releaseDate, @required int runtime, @required ReleaseDates releaseDates, @required double voteAverage, @required List<Genre> genres, @required String homepage, @required Videos video, }) = _Movie; const Movie._() : super(); factory Movie.fromJson(Map<String, dynamic> json) => Movie( id: json['id'] as int ?? -0, title: json['title'] as String ?? "", posterPath: json['poster_path'] as String ?? "", overview: json['overview'] as String ?? "", releaseDate: json['release_date'] as String ?? "", runtime: json['runtime'] as int ?? 0, voteAverage: (json['vote_average'] as num)?.toDouble() ?? 0.0, homepage: json['homepage'] as String ?? "n/a", genres: (json['genres'] as List ?? [ {"id": -0, "name": "n/a"} ]) .map((genre) => Genre.fromJson(genre as Map<String, dynamic>)) .toList(), releaseDates: ReleaseDates.fromJson( json["release_dates"] as Map<String, dynamic> ?? {"release_dates": []}), video: Videos.fromJson(json["videos"] as Map<String, dynamic> ?? {"": ""}), ); @override Map<String, dynamic> toJson() => { "id": id, "title": title, "poster_path": posterPath, "overview": overview, "runtime": runtime, "release_date": releaseDate, "release_dates": releaseDates, "homepage": homepage, "vote_average": voteAverage, "genres": genres, "videos": video, }; factory Movie.fromFirebase(DocumentSnapshot doc) => Movie.fromJson(doc.data()); }
0
mirrored_repositories/movingPictures/lib/domain/home/movies
mirrored_repositories/movingPictures/lib/domain/home/movies/movie/movies_failure.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'movies_failure.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; /// @nodoc class _$MovieFailureTearOff { const _$MovieFailureTearOff(); // ignore: unused_element _Unexpected unexpected() { return const _Unexpected(); } // ignore: unused_element _NoInternetConnection noInternetConnection() { return const _NoInternetConnection(); } // ignore: unused_element _UnableToAdd unableToAdd() { return const _UnableToAdd(); } // ignore: unused_element _InsufficientPermissions insufficientPermissions() { return const _InsufficientPermissions(); } } /// @nodoc // ignore: unused_element const $MovieFailure = _$MovieFailureTearOff(); /// @nodoc mixin _$MovieFailure { @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }); @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }); @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }); @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }); } /// @nodoc abstract class $MovieFailureCopyWith<$Res> { factory $MovieFailureCopyWith( MovieFailure value, $Res Function(MovieFailure) then) = _$MovieFailureCopyWithImpl<$Res>; } /// @nodoc class _$MovieFailureCopyWithImpl<$Res> implements $MovieFailureCopyWith<$Res> { _$MovieFailureCopyWithImpl(this._value, this._then); final MovieFailure _value; // ignore: unused_field final $Res Function(MovieFailure) _then; } /// @nodoc abstract class _$UnexpectedCopyWith<$Res> { factory _$UnexpectedCopyWith( _Unexpected value, $Res Function(_Unexpected) then) = __$UnexpectedCopyWithImpl<$Res>; } /// @nodoc class __$UnexpectedCopyWithImpl<$Res> extends _$MovieFailureCopyWithImpl<$Res> implements _$UnexpectedCopyWith<$Res> { __$UnexpectedCopyWithImpl( _Unexpected _value, $Res Function(_Unexpected) _then) : super(_value, (v) => _then(v as _Unexpected)); @override _Unexpected get _value => super._value as _Unexpected; } /// @nodoc class _$_Unexpected implements _Unexpected { const _$_Unexpected(); @override String toString() { return 'MovieFailure.unexpected()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Unexpected); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unexpected(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unexpected(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(this); } return orElse(); } } abstract class _Unexpected implements MovieFailure { const factory _Unexpected() = _$_Unexpected; } /// @nodoc abstract class _$NoInternetConnectionCopyWith<$Res> { factory _$NoInternetConnectionCopyWith(_NoInternetConnection value, $Res Function(_NoInternetConnection) then) = __$NoInternetConnectionCopyWithImpl<$Res>; } /// @nodoc class __$NoInternetConnectionCopyWithImpl<$Res> extends _$MovieFailureCopyWithImpl<$Res> implements _$NoInternetConnectionCopyWith<$Res> { __$NoInternetConnectionCopyWithImpl( _NoInternetConnection _value, $Res Function(_NoInternetConnection) _then) : super(_value, (v) => _then(v as _NoInternetConnection)); @override _NoInternetConnection get _value => super._value as _NoInternetConnection; } /// @nodoc class _$_NoInternetConnection implements _NoInternetConnection { const _$_NoInternetConnection(); @override String toString() { return 'MovieFailure.noInternetConnection()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _NoInternetConnection); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return noInternetConnection(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (noInternetConnection != null) { return noInternetConnection(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return noInternetConnection(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (noInternetConnection != null) { return noInternetConnection(this); } return orElse(); } } abstract class _NoInternetConnection implements MovieFailure { const factory _NoInternetConnection() = _$_NoInternetConnection; } /// @nodoc abstract class _$UnableToAddCopyWith<$Res> { factory _$UnableToAddCopyWith( _UnableToAdd value, $Res Function(_UnableToAdd) then) = __$UnableToAddCopyWithImpl<$Res>; } /// @nodoc class __$UnableToAddCopyWithImpl<$Res> extends _$MovieFailureCopyWithImpl<$Res> implements _$UnableToAddCopyWith<$Res> { __$UnableToAddCopyWithImpl( _UnableToAdd _value, $Res Function(_UnableToAdd) _then) : super(_value, (v) => _then(v as _UnableToAdd)); @override _UnableToAdd get _value => super._value as _UnableToAdd; } /// @nodoc class _$_UnableToAdd implements _UnableToAdd { const _$_UnableToAdd(); @override String toString() { return 'MovieFailure.unableToAdd()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _UnableToAdd); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unableToAdd(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (unableToAdd != null) { return unableToAdd(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unableToAdd(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (unableToAdd != null) { return unableToAdd(this); } return orElse(); } } abstract class _UnableToAdd implements MovieFailure { const factory _UnableToAdd() = _$_UnableToAdd; } /// @nodoc abstract class _$InsufficientPermissionsCopyWith<$Res> { factory _$InsufficientPermissionsCopyWith(_InsufficientPermissions value, $Res Function(_InsufficientPermissions) then) = __$InsufficientPermissionsCopyWithImpl<$Res>; } /// @nodoc class __$InsufficientPermissionsCopyWithImpl<$Res> extends _$MovieFailureCopyWithImpl<$Res> implements _$InsufficientPermissionsCopyWith<$Res> { __$InsufficientPermissionsCopyWithImpl(_InsufficientPermissions _value, $Res Function(_InsufficientPermissions) _then) : super(_value, (v) => _then(v as _InsufficientPermissions)); @override _InsufficientPermissions get _value => super._value as _InsufficientPermissions; } /// @nodoc class _$_InsufficientPermissions implements _InsufficientPermissions { const _$_InsufficientPermissions(); @override String toString() { return 'MovieFailure.insufficientPermissions()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _InsufficientPermissions); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return insufficientPermissions(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (insufficientPermissions != null) { return insufficientPermissions(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return insufficientPermissions(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (insufficientPermissions != null) { return insufficientPermissions(this); } return orElse(); } } abstract class _InsufficientPermissions implements MovieFailure { const factory _InsufficientPermissions() = _$_InsufficientPermissions; }
0
mirrored_repositories/movingPictures/lib/domain/home/movies
mirrored_repositories/movingPictures/lib/domain/home/movies/movie/movie.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'movie.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; Movie _$MovieFromJson(Map<String, dynamic> json) { return _Movie.fromJson(json); } /// @nodoc class _$MovieTearOff { const _$MovieTearOff(); // ignore: unused_element _Movie call( {@required int id, @required String title, @required String posterPath, @required String overview, @required String releaseDate, @required int runtime, @required ReleaseDates releaseDates, @required double voteAverage, @required List<Genre> genres, @required String homepage, @required Videos video}) { return _Movie( id: id, title: title, posterPath: posterPath, overview: overview, releaseDate: releaseDate, runtime: runtime, releaseDates: releaseDates, voteAverage: voteAverage, genres: genres, homepage: homepage, video: video, ); } // ignore: unused_element Movie fromJson(Map<String, Object> json) { return Movie.fromJson(json); } } /// @nodoc // ignore: unused_element const $Movie = _$MovieTearOff(); /// @nodoc mixin _$Movie { int get id; String get title; String get posterPath; String get overview; String get releaseDate; int get runtime; ReleaseDates get releaseDates; double get voteAverage; List<Genre> get genres; String get homepage; Videos get video; Map<String, dynamic> toJson(); $MovieCopyWith<Movie> get copyWith; } /// @nodoc abstract class $MovieCopyWith<$Res> { factory $MovieCopyWith(Movie value, $Res Function(Movie) then) = _$MovieCopyWithImpl<$Res>; $Res call( {int id, String title, String posterPath, String overview, String releaseDate, int runtime, ReleaseDates releaseDates, double voteAverage, List<Genre> genres, String homepage, Videos video}); } /// @nodoc class _$MovieCopyWithImpl<$Res> implements $MovieCopyWith<$Res> { _$MovieCopyWithImpl(this._value, this._then); final Movie _value; // ignore: unused_field final $Res Function(Movie) _then; @override $Res call({ Object id = freezed, Object title = freezed, Object posterPath = freezed, Object overview = freezed, Object releaseDate = freezed, Object runtime = freezed, Object releaseDates = freezed, Object voteAverage = freezed, Object genres = freezed, Object homepage = freezed, Object video = freezed, }) { return _then(_value.copyWith( id: id == freezed ? _value.id : id as int, title: title == freezed ? _value.title : title as String, posterPath: posterPath == freezed ? _value.posterPath : posterPath as String, overview: overview == freezed ? _value.overview : overview as String, releaseDate: releaseDate == freezed ? _value.releaseDate : releaseDate as String, runtime: runtime == freezed ? _value.runtime : runtime as int, releaseDates: releaseDates == freezed ? _value.releaseDates : releaseDates as ReleaseDates, voteAverage: voteAverage == freezed ? _value.voteAverage : voteAverage as double, genres: genres == freezed ? _value.genres : genres as List<Genre>, homepage: homepage == freezed ? _value.homepage : homepage as String, video: video == freezed ? _value.video : video as Videos, )); } } /// @nodoc abstract class _$MovieCopyWith<$Res> implements $MovieCopyWith<$Res> { factory _$MovieCopyWith(_Movie value, $Res Function(_Movie) then) = __$MovieCopyWithImpl<$Res>; @override $Res call( {int id, String title, String posterPath, String overview, String releaseDate, int runtime, ReleaseDates releaseDates, double voteAverage, List<Genre> genres, String homepage, Videos video}); } /// @nodoc class __$MovieCopyWithImpl<$Res> extends _$MovieCopyWithImpl<$Res> implements _$MovieCopyWith<$Res> { __$MovieCopyWithImpl(_Movie _value, $Res Function(_Movie) _then) : super(_value, (v) => _then(v as _Movie)); @override _Movie get _value => super._value as _Movie; @override $Res call({ Object id = freezed, Object title = freezed, Object posterPath = freezed, Object overview = freezed, Object releaseDate = freezed, Object runtime = freezed, Object releaseDates = freezed, Object voteAverage = freezed, Object genres = freezed, Object homepage = freezed, Object video = freezed, }) { return _then(_Movie( id: id == freezed ? _value.id : id as int, title: title == freezed ? _value.title : title as String, posterPath: posterPath == freezed ? _value.posterPath : posterPath as String, overview: overview == freezed ? _value.overview : overview as String, releaseDate: releaseDate == freezed ? _value.releaseDate : releaseDate as String, runtime: runtime == freezed ? _value.runtime : runtime as int, releaseDates: releaseDates == freezed ? _value.releaseDates : releaseDates as ReleaseDates, voteAverage: voteAverage == freezed ? _value.voteAverage : voteAverage as double, genres: genres == freezed ? _value.genres : genres as List<Genre>, homepage: homepage == freezed ? _value.homepage : homepage as String, video: video == freezed ? _value.video : video as Videos, )); } } @JsonSerializable() /// @nodoc class _$_Movie extends _Movie { const _$_Movie( {@required this.id, @required this.title, @required this.posterPath, @required this.overview, @required this.releaseDate, @required this.runtime, @required this.releaseDates, @required this.voteAverage, @required this.genres, @required this.homepage, @required this.video}) : assert(id != null), assert(title != null), assert(posterPath != null), assert(overview != null), assert(releaseDate != null), assert(runtime != null), assert(releaseDates != null), assert(voteAverage != null), assert(genres != null), assert(homepage != null), assert(video != null), super._(); factory _$_Movie.fromJson(Map<String, dynamic> json) => _$_$_MovieFromJson(json); @override final int id; @override final String title; @override final String posterPath; @override final String overview; @override final String releaseDate; @override final int runtime; @override final ReleaseDates releaseDates; @override final double voteAverage; @override final List<Genre> genres; @override final String homepage; @override final Videos video; @override String toString() { return 'Movie(id: $id, title: $title, posterPath: $posterPath, overview: $overview, releaseDate: $releaseDate, runtime: $runtime, releaseDates: $releaseDates, voteAverage: $voteAverage, genres: $genres, homepage: $homepage, video: $video)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Movie && (identical(other.id, id) || const DeepCollectionEquality().equals(other.id, id)) && (identical(other.title, title) || const DeepCollectionEquality().equals(other.title, title)) && (identical(other.posterPath, posterPath) || const DeepCollectionEquality() .equals(other.posterPath, posterPath)) && (identical(other.overview, overview) || const DeepCollectionEquality() .equals(other.overview, overview)) && (identical(other.releaseDate, releaseDate) || const DeepCollectionEquality() .equals(other.releaseDate, releaseDate)) && (identical(other.runtime, runtime) || const DeepCollectionEquality() .equals(other.runtime, runtime)) && (identical(other.releaseDates, releaseDates) || const DeepCollectionEquality() .equals(other.releaseDates, releaseDates)) && (identical(other.voteAverage, voteAverage) || const DeepCollectionEquality() .equals(other.voteAverage, voteAverage)) && (identical(other.genres, genres) || const DeepCollectionEquality().equals(other.genres, genres)) && (identical(other.homepage, homepage) || const DeepCollectionEquality() .equals(other.homepage, homepage)) && (identical(other.video, video) || const DeepCollectionEquality().equals(other.video, video))); } @override int get hashCode => runtimeType.hashCode ^ const DeepCollectionEquality().hash(id) ^ const DeepCollectionEquality().hash(title) ^ const DeepCollectionEquality().hash(posterPath) ^ const DeepCollectionEquality().hash(overview) ^ const DeepCollectionEquality().hash(releaseDate) ^ const DeepCollectionEquality().hash(runtime) ^ const DeepCollectionEquality().hash(releaseDates) ^ const DeepCollectionEquality().hash(voteAverage) ^ const DeepCollectionEquality().hash(genres) ^ const DeepCollectionEquality().hash(homepage) ^ const DeepCollectionEquality().hash(video); @override _$MovieCopyWith<_Movie> get copyWith => __$MovieCopyWithImpl<_Movie>(this, _$identity); @override Map<String, dynamic> toJson() { return _$_$_MovieToJson(this); } } abstract class _Movie extends Movie { const _Movie._() : super._(); const factory _Movie( {@required int id, @required String title, @required String posterPath, @required String overview, @required String releaseDate, @required int runtime, @required ReleaseDates releaseDates, @required double voteAverage, @required List<Genre> genres, @required String homepage, @required Videos video}) = _$_Movie; factory _Movie.fromJson(Map<String, dynamic> json) = _$_Movie.fromJson; @override int get id; @override String get title; @override String get posterPath; @override String get overview; @override String get releaseDate; @override int get runtime; @override ReleaseDates get releaseDates; @override double get voteAverage; @override List<Genre> get genres; @override String get homepage; @override Videos get video; @override _$MovieCopyWith<_Movie> get copyWith; }
0
mirrored_repositories/movingPictures/lib/domain/home/movies
mirrored_repositories/movingPictures/lib/domain/home/movies/movie/movie.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'movie.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** _$_Movie _$_$_MovieFromJson(Map<String, dynamic> json) { return _$_Movie( id: json['id'] as int, title: json['title'] as String, posterPath: json['posterPath'] as String, overview: json['overview'] as String, releaseDate: json['releaseDate'] as String, runtime: json['runtime'] as int, releaseDates: json['releaseDates'] == null ? null : ReleaseDates.fromJson(json['releaseDates'] as Map<String, dynamic>), voteAverage: (json['voteAverage'] as num)?.toDouble(), genres: (json['genres'] as List) ?.map( (e) => e == null ? null : Genre.fromJson(e as Map<String, dynamic>)) ?.toList(), homepage: json['homepage'] as String, video: json['video'] == null ? null : Videos.fromJson(json['video'] as Map<String, dynamic>), ); } Map<String, dynamic> _$_$_MovieToJson(_$_Movie instance) => <String, dynamic>{ 'id': instance.id, 'title': instance.title, 'posterPath': instance.posterPath, 'overview': instance.overview, 'releaseDate': instance.releaseDate, 'runtime': instance.runtime, 'releaseDates': instance.releaseDates?.toJson(), 'voteAverage': instance.voteAverage, 'genres': instance.genres?.map((e) => e?.toJson())?.toList(), 'homepage': instance.homepage, 'video': instance.video?.toJson(), };
0
mirrored_repositories/movingPictures/lib/domain/home/movies
mirrored_repositories/movingPictures/lib/domain/home/movies/movie/movies_failure.dart
import 'package:freezed_annotation/freezed_annotation.dart'; part 'movies_failure.freezed.dart'; @freezed abstract class MovieFailure with _$MovieFailure { const factory MovieFailure.unexpected() = _Unexpected; const factory MovieFailure.noInternetConnection() = _NoInternetConnection; const factory MovieFailure.unableToAdd() = _UnableToAdd; const factory MovieFailure.insufficientPermissions() = _InsufficientPermissions; }
0
mirrored_repositories/movingPictures/lib/domain/home/movies
mirrored_repositories/movingPictures/lib/domain/home/movies/favorite_movies/favorite_movies.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:equatable/equatable.dart'; class FavoriteMovie extends Equatable { final int favoriteMovieId; const FavoriteMovie({int favoriteMovieId}) : favoriteMovieId = favoriteMovieId ?? favoriteMovieId, super(); Map<String, dynamic> toJson() => {"id": favoriteMovieId}; factory FavoriteMovie.fromJsonData(Map<String, dynamic> json) => FavoriteMovie(favoriteMovieId: json["id"] as int ?? -0); factory FavoriteMovie.fromFirebase(DocumentSnapshot doc) => FavoriteMovie.fromJsonData(doc.data()); @override List<Object> get props => [favoriteMovieId]; }
0
mirrored_repositories/movingPictures/lib/domain/home/movies
mirrored_repositories/movingPictures/lib/domain/home/movies/movie_sub/movie_sub.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'movie_sub.freezed.dart'; @freezed abstract class MovieSub implements _$MovieSub { const factory MovieSub({ @required int id, @required String title, @required String posterPath, }) = _MovieSub; const MovieSub._(); factory MovieSub.fromJsonData(Map<String, dynamic> json) => MovieSub( id: json['id'] as int ?? 0, title: json['title'] as String ?? "n/a", posterPath: json['poster_path'] as String ?? "", ); Map<String, dynamic> toJson() => { "id": id, "title": title, "poster_path": posterPath, }; factory MovieSub.fromFirebase(DocumentSnapshot doc) => MovieSub.fromJsonData(doc.data()); }
0
mirrored_repositories/movingPictures/lib/domain/home/movies
mirrored_repositories/movingPictures/lib/domain/home/movies/movie_sub/movie_sub.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'movie_sub.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; /// @nodoc class _$MovieSubTearOff { const _$MovieSubTearOff(); // ignore: unused_element _MovieSub call( {@required int id, @required String title, @required String posterPath}) { return _MovieSub( id: id, title: title, posterPath: posterPath, ); } } /// @nodoc // ignore: unused_element const $MovieSub = _$MovieSubTearOff(); /// @nodoc mixin _$MovieSub { int get id; String get title; String get posterPath; $MovieSubCopyWith<MovieSub> get copyWith; } /// @nodoc abstract class $MovieSubCopyWith<$Res> { factory $MovieSubCopyWith(MovieSub value, $Res Function(MovieSub) then) = _$MovieSubCopyWithImpl<$Res>; $Res call({int id, String title, String posterPath}); } /// @nodoc class _$MovieSubCopyWithImpl<$Res> implements $MovieSubCopyWith<$Res> { _$MovieSubCopyWithImpl(this._value, this._then); final MovieSub _value; // ignore: unused_field final $Res Function(MovieSub) _then; @override $Res call({ Object id = freezed, Object title = freezed, Object posterPath = freezed, }) { return _then(_value.copyWith( id: id == freezed ? _value.id : id as int, title: title == freezed ? _value.title : title as String, posterPath: posterPath == freezed ? _value.posterPath : posterPath as String, )); } } /// @nodoc abstract class _$MovieSubCopyWith<$Res> implements $MovieSubCopyWith<$Res> { factory _$MovieSubCopyWith(_MovieSub value, $Res Function(_MovieSub) then) = __$MovieSubCopyWithImpl<$Res>; @override $Res call({int id, String title, String posterPath}); } /// @nodoc class __$MovieSubCopyWithImpl<$Res> extends _$MovieSubCopyWithImpl<$Res> implements _$MovieSubCopyWith<$Res> { __$MovieSubCopyWithImpl(_MovieSub _value, $Res Function(_MovieSub) _then) : super(_value, (v) => _then(v as _MovieSub)); @override _MovieSub get _value => super._value as _MovieSub; @override $Res call({ Object id = freezed, Object title = freezed, Object posterPath = freezed, }) { return _then(_MovieSub( id: id == freezed ? _value.id : id as int, title: title == freezed ? _value.title : title as String, posterPath: posterPath == freezed ? _value.posterPath : posterPath as String, )); } } /// @nodoc class _$_MovieSub extends _MovieSub { const _$_MovieSub( {@required this.id, @required this.title, @required this.posterPath}) : assert(id != null), assert(title != null), assert(posterPath != null), super._(); @override final int id; @override final String title; @override final String posterPath; @override String toString() { return 'MovieSub(id: $id, title: $title, posterPath: $posterPath)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _MovieSub && (identical(other.id, id) || const DeepCollectionEquality().equals(other.id, id)) && (identical(other.title, title) || const DeepCollectionEquality().equals(other.title, title)) && (identical(other.posterPath, posterPath) || const DeepCollectionEquality() .equals(other.posterPath, posterPath))); } @override int get hashCode => runtimeType.hashCode ^ const DeepCollectionEquality().hash(id) ^ const DeepCollectionEquality().hash(title) ^ const DeepCollectionEquality().hash(posterPath); @override _$MovieSubCopyWith<_MovieSub> get copyWith => __$MovieSubCopyWithImpl<_MovieSub>(this, _$identity); } abstract class _MovieSub extends MovieSub { const _MovieSub._() : super._(); const factory _MovieSub( {@required int id, @required String title, @required String posterPath}) = _$_MovieSub; @override int get id; @override String get title; @override String get posterPath; @override _$MovieSubCopyWith<_MovieSub> get copyWith; }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/people/people_failure.freezed.dart
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies part of 'people_failure.dart'; // ************************************************************************** // FreezedGenerator // ************************************************************************** T _$identity<T>(T value) => value; /// @nodoc class _$PeopleFailureTearOff { const _$PeopleFailureTearOff(); // ignore: unused_element _Unexpected unexpected() { return const _Unexpected(); } // ignore: unused_element _NoInternetConnection noInternetConnection() { return const _NoInternetConnection(); } // ignore: unused_element _UnableToAdd unableToAdd() { return const _UnableToAdd(); } // ignore: unused_element _InsufficientPermissions insufficientPermissions() { return const _InsufficientPermissions(); } } /// @nodoc // ignore: unused_element const $PeopleFailure = _$PeopleFailureTearOff(); /// @nodoc mixin _$PeopleFailure { @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }); @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }); @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }); @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }); } /// @nodoc abstract class $PeopleFailureCopyWith<$Res> { factory $PeopleFailureCopyWith( PeopleFailure value, $Res Function(PeopleFailure) then) = _$PeopleFailureCopyWithImpl<$Res>; } /// @nodoc class _$PeopleFailureCopyWithImpl<$Res> implements $PeopleFailureCopyWith<$Res> { _$PeopleFailureCopyWithImpl(this._value, this._then); final PeopleFailure _value; // ignore: unused_field final $Res Function(PeopleFailure) _then; } /// @nodoc abstract class _$UnexpectedCopyWith<$Res> { factory _$UnexpectedCopyWith( _Unexpected value, $Res Function(_Unexpected) then) = __$UnexpectedCopyWithImpl<$Res>; } /// @nodoc class __$UnexpectedCopyWithImpl<$Res> extends _$PeopleFailureCopyWithImpl<$Res> implements _$UnexpectedCopyWith<$Res> { __$UnexpectedCopyWithImpl( _Unexpected _value, $Res Function(_Unexpected) _then) : super(_value, (v) => _then(v as _Unexpected)); @override _Unexpected get _value => super._value as _Unexpected; } /// @nodoc class _$_Unexpected implements _Unexpected { const _$_Unexpected(); @override String toString() { return 'PeopleFailure.unexpected()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _Unexpected); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unexpected(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unexpected(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (unexpected != null) { return unexpected(this); } return orElse(); } } abstract class _Unexpected implements PeopleFailure { const factory _Unexpected() = _$_Unexpected; } /// @nodoc abstract class _$NoInternetConnectionCopyWith<$Res> { factory _$NoInternetConnectionCopyWith(_NoInternetConnection value, $Res Function(_NoInternetConnection) then) = __$NoInternetConnectionCopyWithImpl<$Res>; } /// @nodoc class __$NoInternetConnectionCopyWithImpl<$Res> extends _$PeopleFailureCopyWithImpl<$Res> implements _$NoInternetConnectionCopyWith<$Res> { __$NoInternetConnectionCopyWithImpl( _NoInternetConnection _value, $Res Function(_NoInternetConnection) _then) : super(_value, (v) => _then(v as _NoInternetConnection)); @override _NoInternetConnection get _value => super._value as _NoInternetConnection; } /// @nodoc class _$_NoInternetConnection implements _NoInternetConnection { const _$_NoInternetConnection(); @override String toString() { return 'PeopleFailure.noInternetConnection()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _NoInternetConnection); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return noInternetConnection(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (noInternetConnection != null) { return noInternetConnection(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return noInternetConnection(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (noInternetConnection != null) { return noInternetConnection(this); } return orElse(); } } abstract class _NoInternetConnection implements PeopleFailure { const factory _NoInternetConnection() = _$_NoInternetConnection; } /// @nodoc abstract class _$UnableToAddCopyWith<$Res> { factory _$UnableToAddCopyWith( _UnableToAdd value, $Res Function(_UnableToAdd) then) = __$UnableToAddCopyWithImpl<$Res>; } /// @nodoc class __$UnableToAddCopyWithImpl<$Res> extends _$PeopleFailureCopyWithImpl<$Res> implements _$UnableToAddCopyWith<$Res> { __$UnableToAddCopyWithImpl( _UnableToAdd _value, $Res Function(_UnableToAdd) _then) : super(_value, (v) => _then(v as _UnableToAdd)); @override _UnableToAdd get _value => super._value as _UnableToAdd; } /// @nodoc class _$_UnableToAdd implements _UnableToAdd { const _$_UnableToAdd(); @override String toString() { return 'PeopleFailure.unableToAdd()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _UnableToAdd); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unableToAdd(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (unableToAdd != null) { return unableToAdd(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return unableToAdd(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (unableToAdd != null) { return unableToAdd(this); } return orElse(); } } abstract class _UnableToAdd implements PeopleFailure { const factory _UnableToAdd() = _$_UnableToAdd; } /// @nodoc abstract class _$InsufficientPermissionsCopyWith<$Res> { factory _$InsufficientPermissionsCopyWith(_InsufficientPermissions value, $Res Function(_InsufficientPermissions) then) = __$InsufficientPermissionsCopyWithImpl<$Res>; } /// @nodoc class __$InsufficientPermissionsCopyWithImpl<$Res> extends _$PeopleFailureCopyWithImpl<$Res> implements _$InsufficientPermissionsCopyWith<$Res> { __$InsufficientPermissionsCopyWithImpl(_InsufficientPermissions _value, $Res Function(_InsufficientPermissions) _then) : super(_value, (v) => _then(v as _InsufficientPermissions)); @override _InsufficientPermissions get _value => super._value as _InsufficientPermissions; } /// @nodoc class _$_InsufficientPermissions implements _InsufficientPermissions { const _$_InsufficientPermissions(); @override String toString() { return 'PeopleFailure.insufficientPermissions()'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other is _InsufficientPermissions); } @override int get hashCode => runtimeType.hashCode; @override @optionalTypeArgs Result when<Result extends Object>({ @required Result unexpected(), @required Result noInternetConnection(), @required Result unableToAdd(), @required Result insufficientPermissions(), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return insufficientPermissions(); } @override @optionalTypeArgs Result maybeWhen<Result extends Object>({ Result unexpected(), Result noInternetConnection(), Result unableToAdd(), Result insufficientPermissions(), @required Result orElse(), }) { assert(orElse != null); if (insufficientPermissions != null) { return insufficientPermissions(); } return orElse(); } @override @optionalTypeArgs Result map<Result extends Object>({ @required Result unexpected(_Unexpected value), @required Result noInternetConnection(_NoInternetConnection value), @required Result unableToAdd(_UnableToAdd value), @required Result insufficientPermissions(_InsufficientPermissions value), }) { assert(unexpected != null); assert(noInternetConnection != null); assert(unableToAdd != null); assert(insufficientPermissions != null); return insufficientPermissions(this); } @override @optionalTypeArgs Result maybeMap<Result extends Object>({ Result unexpected(_Unexpected value), Result noInternetConnection(_NoInternetConnection value), Result unableToAdd(_UnableToAdd value), Result insufficientPermissions(_InsufficientPermissions value), @required Result orElse(), }) { assert(orElse != null); if (insufficientPermissions != null) { return insufficientPermissions(this); } return orElse(); } } abstract class _InsufficientPermissions implements PeopleFailure { const factory _InsufficientPermissions() = _$_InsufficientPermissions; }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/people/people.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:meta/meta.dart'; class Person { final String email; final String name; final String photoURL; // final List<PersonFavMovie> favoriteMovies; // final List<PersonFavSerie> favoriteSeries; Person({ @required this.email, @required this.name, @required this.photoURL, // @required this.favoriteMovies, // @required this.favoriteSeries, }); factory Person.fromJsonData(Map<String, dynamic> json) => Person( email: json['email'] as String, name: json['name'] as String, photoURL: json['photoURL'] as String, // favoriteMovies: List<PersonFavMovie>.from(json['movies'].map( // (x) => PersonFavMovie.fromJsonData(x as Map<String, dynamic>), // ) as Iterable), // favoriteSeries: List<PersonFavSerie>.from(json['series'].map( // (x) => PersonFavSerie.fromJsonData(x as Map<String, dynamic>), // ) as Iterable), ); Map<String, dynamic> toJson() => { "email": email, "name": name, "photoURL": photoURL, }; factory Person.fromFirebase(DocumentSnapshot doc) => Person.fromJsonData(doc.data()); } // class PersonFavMovie { // final int favoriteMovieId; // PersonFavMovie({@required this.favoriteMovieId}); // factory PersonFavMovie.fromJsonData(Map<String, dynamic> json) => // PersonFavMovie(favoriteMovieId: json["id"] as int ?? -0); // } // class PersonFavSerie { // final int favoriteSerieId; // PersonFavSerie({@required this.favoriteSerieId}); // factory PersonFavSerie.fromJsonData(Map<String, dynamic> json) => // PersonFavSerie(favoriteSerieId: json["id"] as int ?? -0); // }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/people/people_interface.dart
import 'package:dartz/dartz.dart'; import 'people.dart'; import 'people_failure.dart'; abstract class PeopleInterface { Stream<Either<PeopleFailure, List<Person>>> watchPeople(); Stream<Either<PeopleFailure, List<Person>>> watchFullPeople(String email); Future<Either<PeopleFailure, Unit>> followPerson(String personEmail); Future<Either<PeopleFailure, Unit>> unFollowPerson(String personEmail); Future<Either<PeopleFailure, Person>> getPersonSearchQuery( String personEmail); }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/people/people_failure.dart
import 'package:freezed_annotation/freezed_annotation.dart'; part 'people_failure.freezed.dart'; @freezed abstract class PeopleFailure with _$PeopleFailure { const factory PeopleFailure.unexpected() = _Unexpected; const factory PeopleFailure.noInternetConnection() = _NoInternetConnection; const factory PeopleFailure.unableToAdd() = _UnableToAdd; const factory PeopleFailure.insufficientPermissions() = _InsufficientPermissions; }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/search/search_interface.dart
import 'package:dartz/dartz.dart'; import '../home/movies/movie/movies_failure.dart'; import 'search.dart'; abstract class SearchInterface { Future<Either<MovieFailure, List<Search>>> getTrending(); Future<Either<MovieFailure, List<Search>>> getSearchQuery(String query); }
0
mirrored_repositories/movingPictures/lib/domain
mirrored_repositories/movingPictures/lib/domain/search/search.dart
class Search { final int id; final String mediaType; Search({this.id, this.mediaType}); factory Search.fromJson(Map<String, dynamic> json) => Search( id: json['id'] as int ?? -0, mediaType: json['media_type'] as String, ); factory Search.toDomain(Search search) => Search( id: search.id, mediaType: search.mediaType, ); }
0
mirrored_repositories/E_Commerce_Flutter_App
mirrored_repositories/E_Commerce_Flutter_App/lib/firebase_options.dart
// File generated by FlutterFire CLI. // ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; /// Default [FirebaseOptions] for use with your Firebase apps. /// /// Example: /// ```dart /// import 'firebase_options.dart'; /// // ... /// await Firebase.initializeApp( /// options: DefaultFirebaseOptions.currentPlatform, /// ); /// ``` class DefaultFirebaseOptions { static FirebaseOptions get currentPlatform { if (kIsWeb) { return web; } switch (defaultTargetPlatform) { case TargetPlatform.android: return android; case TargetPlatform.iOS: return ios; case TargetPlatform.macOS: return macos; case TargetPlatform.windows: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for windows - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); case TargetPlatform.linux: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for linux - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); default: throw UnsupportedError( 'DefaultFirebaseOptions are not supported for this platform.', ); } } static const FirebaseOptions web = FirebaseOptions( apiKey: "AIzaSyAoHieScljNhMX6JqY8OD1qZY7e8mgT-y4", authDomain: "ecommercemad-1c610.firebaseapp.com", projectId: "ecommercemad-1c610", storageBucket: "ecommercemad-1c610.appspot.com", messagingSenderId: "350559422755", appId: "1:350559422755:web:6cf98f0f160467099ce496" ); // static const FirebaseOptions android = FirebaseOptions( // apiKey: 'AIzaSyBivtm1cSmtBWzocFrw-lGrZZm_HHrG55c', // appId: '1:350559422755:android:55cbe4f535e91a1c9ce496', // messagingSenderId: '350559422755', // projectId: 'ecommercemad-1c610', // storageBucket: 'ecommercemad-1c610.appspot.com', // ); static const FirebaseOptions android = FirebaseOptions( apiKey: 'AIzaSyBivtm1cSmtBWzocFrw-lGrZZm_HHrG55c', appId: '1:350559422755:android:c432f9be274c28fd9ce496', messagingSenderId: '350559422755', projectId: 'ecommercemad-1c610', storageBucket: 'ecommercemad-1c610.appspot.com', ); static const FirebaseOptions ios = FirebaseOptions( apiKey: 'AIzaSyBivtm1cSmtBWzocFrw-lGrZZm_HHrG55c', appId: '1:350559422755:android:55cbe4f535e91a1c9ce496', messagingSenderId: '350559422755', projectId: 'ecommercemad-1c610', storageBucket: 'ecommercemad-1c610.appspot.com', iosBundleId: 'com.example.firebaseSetup', ); static const FirebaseOptions macos = FirebaseOptions( apiKey: 'AIzaSyDjz_xUfFzK8DlVJUnYpanDv2s8AI9KhpQ', appId: '1:302962007808:ios:be0965d2d44a3fc5915de5', messagingSenderId: '302962007808', projectId: 'fire-base-test-2-c65e9', storageBucket: 'fire-base-test-2-c65e9.appspot.com', iosBundleId: 'com.example.firebaseSetup.RunnerTests', ); }
0
mirrored_repositories/E_Commerce_Flutter_App
mirrored_repositories/E_Commerce_Flutter_App/lib/main.dart
import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'firebase_options.dart'; import '../components/AppSignIn.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( themeMode: ThemeMode.light, theme: ThemeData(primarySwatch: Colors.blue), //primarySwatch: Colors.amber debugShowCheckedModeBanner: false, home: const AppSignIn(), ); } // MaterialApp } // MyApp
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/common_widget/TopPromoSlider.dart
import 'package:flutter/material.dart'; import 'package:carousel_slider/carousel_slider.dart'; class TopPromoSlider extends StatelessWidget { final List<String> imageUrls = [ "https://graphicsfamily.com/wp-content/uploads/edd/2023/05/Free-Realistic-T-Shirt-Mockup--1536x1114.jpg", "https://graphicsfamily.com/wp-content/uploads/edd/2022/11/Free-Socks-Design-Mockup-B-1536x960.jpg", ]; TopPromoSlider({super.key}); @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only(left: 10, right: 10), child: SizedBox( height: 200.0, width: double.infinity, child: CarouselSlider( items: imageUrls.map((imageUrl) { return Image.network( imageUrl, height: 200, width: double.infinity, fit: BoxFit.cover, ); }).toList(), options: CarouselOptions( height: 150.0, viewportFraction: 1.0, autoPlay: true, autoPlayInterval: const Duration(seconds: 3), autoPlayAnimationDuration: const Duration(milliseconds: 800), enlargeCenterPage: true, // Other options go here ), ), ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/common_widget/BottomNavBarWidget.dart
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class BottomNavBarWidget extends StatefulWidget { const BottomNavBarWidget({super.key}); @override _BottomNavBarWidgetState createState() => _BottomNavBarWidgetState(); } class _BottomNavBarWidgetState extends State<BottomNavBarWidget> { int _selectedIndex = 0; void _onItemTapped(int index) { setState(() { _selectedIndex = index; navigateToScreens(index); }); } void navigateToScreens(int index) { // Adjust the navigation logic based on your app structure switch (index) { case 0: Navigator.pushNamed(context, '/home'); break; case 1: Navigator.pushNamed(context, '/wish_list'); break; case 2: Navigator.pushNamed(context, '/cart'); break; case 3: Navigator.pushNamed(context, '/dashboard'); break; default: break; } } @override Widget build(BuildContext context) { return BottomNavigationBar( type: BottomNavigationBarType.fixed, items: <BottomNavigationBarItem>[ BottomNavigationBarItem( icon: Icon(Icons.home), label: 'Home', ), BottomNavigationBarItem( icon: Icon(FontAwesomeIcons.heart), label: 'Wish List', ), BottomNavigationBarItem( icon: Icon(FontAwesomeIcons.shoppingBag), label: 'Cart', ), BottomNavigationBarItem( icon: Icon(FontAwesomeIcons.dashcube), label: 'Dashboard', ), ], currentIndex: _selectedIndex, selectedItemColor: Color(0xFFAA292E), onTap: _onItemTapped, ); } } void main() { runApp( MaterialApp( home: Scaffold( body: Center(child: Text('Home Screen')), ), onGenerateRoute: (settings) { if (settings.name == '/home') { return MaterialPageRoute(builder: (context) => HomeScreen()); } else if (settings.name == '/wish_list') { return MaterialPageRoute(builder: (context) => WishListScreen()); } else if (settings.name == '/cart') { return MaterialPageRoute(builder: (context) => CartScreen()); } else if (settings.name == '/dashboard') { return MaterialPageRoute(builder: (context) => DashboardScreen()); } return null; }, ), ); } class HomeScreen extends StatelessWidget { const HomeScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Home')), body: Center(child: Text('Home Screen')), ); } } class WishListScreen extends StatelessWidget { const WishListScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Wish List')), body: Center(child: Text('Wish List Screen')), ); } } class CartScreen extends StatelessWidget { const CartScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Cart')), body: Center(child: Text('Cart Screen')), ); } } class DashboardScreen extends StatelessWidget { const DashboardScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Dashboard')), body: Center(child: Text('Dashboard Screen')), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/common_widget/SearchWidget.dart
import 'package:flutter/material.dart'; class SearchBarWidget extends StatelessWidget { final TextEditingController _searchController = TextEditingController(); SearchBarWidget({super.key}); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.symmetric(horizontal: 16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), ), child: Row( children: [ const Icon(Icons.search), const SizedBox(width: 8), Expanded( child: TextField( controller: _searchController, decoration: const InputDecoration( hintText: 'What would you like to buy?', border: InputBorder.none, ), ), ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/common_widget/PopularMenuUser.dart
// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../User_ screens/Beauty.dart'; import '../User_ screens/Shoes.dart'; import '../User_ screens/Clothing.dart'; import '../User_ screens/Mobbile.dart'; class PopularMenu extends StatelessWidget { double width = 55.0, height = 55.0; double customFontSize = 13; String defaultFontFamily = 'Roboto-Light.ttf'; PopularMenu({super.key}); @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.all(10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Column( children: <Widget>[ Container( width: width, height: height, decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), child: RawMaterialButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => Beauty(), ), ); }, shape: CircleBorder(), child: Icon( FontAwesomeIcons.female, color: Color(0xFFAB436B), ), ), ), Text( "Women Fashion", style: TextStyle( color: Color(0xFF969696), fontFamily: 'Roboto-Light.ttf', fontSize: customFontSize), ) ], ), Column( children: <Widget>[ Container( width: width, height: height, decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), child: RawMaterialButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => Mobile(), ), ); }, shape: CircleBorder(), child: Icon( FontAwesomeIcons.mobile, color: Color(0xFFC1A17C), ), ), ), Text( "Mobiles", style: TextStyle( color: Color(0xFF969696), fontFamily: defaultFontFamily, fontSize: customFontSize), ) ], ), Column( children: <Widget>[ Container( width: width, height: height, decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), child: RawMaterialButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ClothingProduct(), ), ); }, shape: CircleBorder(), child: Icon( FontAwesomeIcons.tshirt, color: Color(0xFF5EB699), ), ), ), Text( "Clothing", style: TextStyle( color: Color(0xFF969696), fontFamily: defaultFontFamily, fontSize: customFontSize), ) ], ), Column( children: <Widget>[ Container( width: width, height: height, decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), child: RawMaterialButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ShoesProducts(), ), ); }, shape: CircleBorder(), child: Icon( FontAwesomeIcons.shoppingBag, color: Color(0xFF4D9DA7), ), ), ), Text( "Shoe & Bag", style: TextStyle( color: Color(0xFF969696), fontFamily: defaultFontFamily, fontSize: customFontSize), ), ], ) ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/common_widget/AppBarWidget.dart
import 'package:flutter/material.dart'; import '../components/AppSignIn.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; PreferredSizeWidget appBarWidget(BuildContext context) => AppBar( elevation: 0.0, centerTitle: true, title: Image.asset( "assets/images/ic_app_icon.png", width: 80, height: 40, ), actions: <Widget>[ IconButton( onPressed: () { Navigator.push( context, MaterialPageRoute(builder: (context) => const AppSignIn()), ); }, icon: const Icon(FontAwesomeIcons.user), color: const Color(0xFF323232), ), ], );
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/common_widget/CircularProgress.dart
import 'package:flutter/material.dart'; class CircularProgress extends StatefulWidget { const CircularProgress({super.key}); @override _CircularProgressState createState() => _CircularProgressState(); } class _CircularProgressState extends State<CircularProgress> { @override Widget build(BuildContext context) { return Container( child: const Center( child: CircularProgressIndicator( ), ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/common_widget/PopularMenu.dart
// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../screens/Shoes.dart'; import '../screens/Clothing.dart'; import '../screens/Mobbile.dart'; import '../screens/Beauty.dart'; class PopularMenu extends StatelessWidget { double width = 55.0, height = 55.0; double customFontSize = 13; String defaultFontFamily = 'Roboto-Light.ttf'; PopularMenu({super.key}); @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.all(10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Column( children: <Widget>[ Container( width: width, height: height, decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), child: RawMaterialButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => Beauty(), ), ); }, shape: CircleBorder(), child: Icon( FontAwesomeIcons.female, color: Color(0xFFAB436B), ), ), ), Text( "Women Fashion", style: TextStyle( color: Color(0xFF969696), fontFamily: 'Roboto-Light.ttf', fontSize: customFontSize), ) ], ), Column( children: <Widget>[ Container( width: width, height: height, decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), child: RawMaterialButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => Mobile(), ), ); }, shape: CircleBorder(), child: Icon( FontAwesomeIcons.mobile, color: Color(0xFFC1A17C), ), ), ), Text( "Mobiles", style: TextStyle( color: Color(0xFF969696), fontFamily: defaultFontFamily, fontSize: customFontSize), ) ], ), Column( children: <Widget>[ Container( width: width, height: height, decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), child: RawMaterialButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ClothingProduct(), ), ); }, shape: CircleBorder(), child: Icon( FontAwesomeIcons.tshirt, color: Color(0xFF5EB699), ), ), ), Text( "Clothing", style: TextStyle( color: Color(0xFF969696), fontFamily: defaultFontFamily, fontSize: customFontSize), ) ], ), Column( children: <Widget>[ Container( width: width, height: height, decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), child: RawMaterialButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ShoesProducts(), ), ); }, shape: CircleBorder(), child: Icon( FontAwesomeIcons.shoppingBag, color: Color(0xFF4D9DA7), ), ), ), Text( "Shoe & Bag", style: TextStyle( color: Color(0xFF969696), fontFamily: defaultFontFamily, fontSize: customFontSize), ), ], ) ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/components/AppSingUp.dart
// ignore_for_file: prefer_const_constructors, sort_child_properties_last import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import '../components/AppSignIn.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; String firstName = ''; String lastName = ''; String phoneNumber = ''; String userName=''; String password = ''; class AppSingUp extends StatelessWidget { const AppSingUp({super.key}); @override Widget build(BuildContext context) { String defaultFontFamily = 'Roboto-Light.ttf'; double defaultFontSize = 14; double defaultIconSize = 17; return Scaffold( body: Container( padding: EdgeInsets.only(left: 20, right: 20, top: 35, bottom: 30), width: double.infinity, height: double.infinity, color: Colors.white70, child: Column( children: <Widget>[ Flexible( flex: 1, child: InkWell( child: Container( child: Align( alignment: Alignment.topLeft, child: Icon(Icons.close), ), ), onTap: () { Navigator.pop(context); }, ), ), Flexible( flex: 5, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( width: 130, height: 130, alignment: Alignment.center, child: Image.network( 'https://cdn0.iconfinder.com/data/icons/gradak-finance-flad/32/ecommerce-21-512.png')), SizedBox( height: 15, ), Row( children: <Widget>[ Flexible( flex: 1, child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "First Name", ), onChanged: (value) { firstName = value; }, ), ), SizedBox( width: 10, ), Flexible( flex: 1, child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "Last Name", ), onChanged: (value) { lastName = value; }, ), ), ], ), SizedBox( height: 15, ), TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.person, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize), hintText: "User Name", ), onChanged: (value) { userName = value; }, ), SizedBox( height: 15, ), TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.phone, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize), hintText: "Phone Number", ), onChanged: (value) { phoneNumber = value; }, ), SizedBox( height: 15, ), TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.password, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "Password", ), onChanged: (value) { password = value; }, ), SizedBox( height: 10, ), Container( width: double.infinity, child: ElevatedButton( onPressed: () { if (firstName == '' || lastName == '' || phoneNumber == '' || password == '' || userName == '') { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Please fill all the fields'), ), ); } else { CollectionReference NewUser = FirebaseFirestore.instance.collection('AllUser'); NewUser.add({ 'FirstName': firstName, 'LastName': lastName, 'UserName': userName, 'Phone': phoneNumber, 'Password': password, 'Role':'User', }); // adding this data in localhost:3000/NodeApi/AddUser http.post( Uri.parse('http://localhost:3000/NodeApi/AddUser'), headers: <String, String>{ 'Content-Type': 'application/json; charset=UTF-8', }, body: jsonEncode(<String, String>{ 'FirstName': firstName, 'LastName': lastName, 'Phone': phoneNumber, 'UserName': userName, 'Password': password, }), ); showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('User Added'), content: Text('User Added Successfully'), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); }, child: Text('OK'), ), ], ); }, ); firstName = ''; lastName = ''; phoneNumber = ''; password = ''; Navigator.push( context, MaterialPageRoute( builder: (context) => AppSignIn()), ); } }, style: ElevatedButton.styleFrom( padding: EdgeInsets.all(17.0), backgroundColor: Color.fromRGBO(27, 117, 188, 1), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15.0), side: BorderSide(color: Color.fromRGBO(27, 117, 188, 1)), ), ), child: Text( "Sign Up", style: TextStyle( color: Colors.white, fontSize: 18, fontFamily: 'Poppins-Medium.ttf', ), textAlign: TextAlign.center, ), ), decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), ), SizedBox( height: 10, ), ], ), ), Flexible( flex: 1, child: Align( alignment: Alignment.bottomCenter, child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( child: Text( "Already have an account? ", style: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, fontStyle: FontStyle.normal, ), ), ), InkWell( onTap: () { Navigator.push( context, MaterialPageRoute(builder: (context) => AppSignIn()), ); }, child: Container( child: Text( "Sign In", style: TextStyle( color: Color.fromRGBO(27, 117, 188, 1), fontFamily: defaultFontFamily, fontSize: defaultFontSize, fontStyle: FontStyle.normal, ), ), ), ), ], ), ), ) ], ), ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/components/AppSignIn.dart
// ignore_for_file: prefer_const_constructors, sort_child_properties_last import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_setup/User_%20screens/CustomerDashboard.dart'; import 'package:flutter/material.dart'; import '../components/AppSingUp.dart'; import '../screens/AdminDashboard.dart'; String phone = ''; String _password = ''; class AppSignIn extends StatefulWidget { const AppSignIn({super.key}); @override _AppSignInState createState() => _AppSignInState(); } class _AppSignInState extends State<AppSignIn> { bool obscureText = true; // State variable to manage text obscuring TextEditingController passwordController = TextEditingController(); // Controller for password field @override Widget build(BuildContext context) { final formKey = GlobalKey<FormState>(); String defaultFontFamily = 'Roboto-Light.ttf'; double defaultFontSize = 14; double defaultIconSize = 17; return Scaffold( body: Form( key: formKey, child: Container( padding: EdgeInsets.only(left: 20, right: 20, top: 35, bottom: 30), width: double.infinity, height: double.infinity, color: Colors.white70, child: Column( children: <Widget>[ Flexible( flex: 1, child: InkWell( child: Container( child: Align( alignment: Alignment.topLeft, child: Icon(Icons.close), ), ), onTap: () { Navigator.pop(context); }, ), ), Flexible( flex: 5, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( width: 130, height: 130, alignment: Alignment.center, child: Image.network( 'https://cdn0.iconfinder.com/data/icons/gradak-finance-flad/32/ecommerce-21-512.png'), ), SizedBox( height: 15, ), TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.person, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize), hintText: "User Name", ), onChanged: (value) { phone = value; }, ), SizedBox( height: 15, ), TextField( controller: passwordController, obscureText: obscureText, showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, fillColor: Color(0xFFF2F3F5), prefixIcon: Icon( Icons.lock_outline, color: Color(0xFF666666), size: defaultIconSize, ), suffixIcon: GestureDetector( onTap: () { setState(() { obscureText = !obscureText; }); }, child: Icon( obscureText ? Icons.visibility : Icons.visibility_off, color: Color(0xFF666666), size: defaultIconSize, ), ), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "Password", ), ), SizedBox( height: 15, ), SizedBox( width: double.infinity, child: Text( "Forgot your password?", style: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, fontStyle: FontStyle.normal, ), textAlign: TextAlign.end, ), ), SizedBox( height: 15, ), Container( width: double.infinity, child: ElevatedButton( onPressed: () { if (passwordController.text.isEmpty || phone.isEmpty) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Please fill all the fields'), backgroundColor: Colors.red, ), ); } else { checkCredentials(phone, passwordController.text) .then((userData) { if (userData != null) { String username = userData['UserName']; String firstName = userData['FirstName']; String lastName = userData['LastName']; String email = userData['Phone']; String role = userData['Role']; String userId = userData['id']; // Get the user ID ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Login Successful'), backgroundColor: Colors.green, ), ); if (role == 'Admin') { // Navigate to the admin dashboard Navigator.push( context, MaterialPageRoute( builder: (context) => AdminDashboard( userId: userId, username: username, firstName: firstName, lastName: lastName, phone: email, ), ), ); } else if (role == 'User') { // Navigate to the user dashboard Navigator.push( context, MaterialPageRoute( builder: (context) => CustomerDashboard( // Pass necessary parameters if needed userId: userId, username: username, firstName: firstName, lastName: lastName, phone: email, ), ), ); } } else { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( 'Login Failed. Invalid credentials.'), backgroundColor: Colors.red, ), ); } }); } }, style: ElevatedButton.styleFrom( padding: EdgeInsets.all(17.0), backgroundColor: const Color.fromRGBO(27, 117, 188, 1), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15.0), side: BorderSide( color: Color.fromRGBO(27, 117, 188, 1)), ), ), child: Text( "Sign In", style: TextStyle( color: Colors.white, fontSize: 18, fontFamily: 'Poppins-Medium.ttf', ), textAlign: TextAlign.center, ), ), decoration: BoxDecoration( shape: BoxShape.circle, color: Color(0xFFF2F3F7)), ), SizedBox( height: 10, ), ], ), ), Flexible( flex: 1, child: Align( alignment: Alignment.bottomCenter, child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( child: Text( "Don't have an account? ", style: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, fontStyle: FontStyle.normal, ), ), ), InkWell( onTap: () => { Navigator.push( context, MaterialPageRoute( builder: (context) => AppSingUp()), ) }, child: Container( child: Text( "Sign Up", style: TextStyle( color: Color.fromRGBO(27, 117, 188, 1), fontFamily: defaultFontFamily, fontSize: defaultFontSize, fontStyle: FontStyle.normal, ), ), ), ), ], ), ), ) ], ), ), ), ); } } Future<Map<String, dynamic>?> checkCredentials( String phoneNumber, String password) async { CollectionReference allUserCollection = FirebaseFirestore.instance.collection('AllUser'); QuerySnapshot querySnapshot = await allUserCollection .where('UserName', isEqualTo: phoneNumber) .where('Password', isEqualTo: password) .get(); if (querySnapshot.docs.isNotEmpty) { // Get the first document in the query result DocumentSnapshot userData = querySnapshot.docs.first; // Extract the user data and ID String userId = userData.id; Map<String, dynamic> userDataMap = userData.data() as Map<String, dynamic>; userDataMap['id'] = userId; // Add user ID to userDataMap // Return the user data along with the ID return userDataMap; } else { // If credentials are invalid or no user found, return null or handle accordingly return null; } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/User_ screens/Shoes.dart
// ignore_for_file: prefer_const_constructors, sized_box_for_whitespace, avoid_print import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; class ShoesProducts extends StatefulWidget { const ShoesProducts({Key? key}) : super(key: key); @override _ShoesProductsState createState() => _ShoesProductsState(); } class _ShoesProductsState extends State<ShoesProducts> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('Catagory', isEqualTo: 'Shoes'.trim()) .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Shoes Product List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ?? 'No description'), Text( '\$${product['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.productSnapshot['ProductName'] ?? 'No name'), ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ?? 'No description'), Text( '\$${widget.productSnapshot['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, child: Text('Add to Cart'), ), ElevatedButton( onPressed: () async { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('Confirm Order'), content: Text('Are you sure you want to place this order?'), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); // Close the dialog }, child: Text('Cancel'), ), TextButton( onPressed: () async { try { // Save data to a new collection or update an existing one await FirebaseFirestore.instance .collection('Orders') .add({ 'UserId':'jQUY47EaPywbj3zXyQpW', // Saving the userId 'ProductId': widget.productSnapshot.id, 'ProductName': widget.productSnapshot['ProductName'], 'Description': widget.productSnapshot['Description'], 'Price': widget.productSnapshot['Price'], // Add more fields as needed }); // Close the dialog Navigator.of(context).pop(); // Show a success message or navigate to a success page ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Order placed successfully!'), backgroundColor: Colors.green, ), ); } catch (error) { print('Error placing order: $error'); // Handle the error appropriately, e.g., show an error message // ... } }, child: Text('Confirm'), ), ], ); }, ); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Order Now', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), ], ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/User_ screens/Mobbile.dart
// ignore_for_file: prefer_const_constructors, sized_box_for_whitespace, avoid_print import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; class Mobile extends StatefulWidget { const Mobile({Key? key}) : super(key: key); @override _MobileState createState() => _MobileState(); } class _MobileState extends State<Mobile> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('Catagory', isEqualTo: 'Mobbile'.trim()) .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Mobiles Product List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ?? 'No description'), Text( '\$${product['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.productSnapshot['ProductName'] ?? 'No name'), ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ?? 'No description'), Text( '\$${widget.productSnapshot['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, child: Text('Add to Cart'), ), ElevatedButton( onPressed: () async { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('Confirm Order'), content: Text('Are you sure you want to place this order?'), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); // Close the dialog }, child: Text('Cancel'), ), TextButton( onPressed: () async { try { // Save data to a new collection or update an existing one await FirebaseFirestore.instance .collection('Orders') .add({ 'UserId':'jQUY47EaPywbj3zXyQpW', // Saving the userId 'ProductId': widget.productSnapshot.id, 'ProductName': widget.productSnapshot['ProductName'], 'Description': widget.productSnapshot['Description'], 'Price': widget.productSnapshot['Price'], // Add more fields as needed }); // Close the dialog Navigator.of(context).pop(); // Show a success message or navigate to a success page ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Order placed successfully!'), backgroundColor: Colors.green, ), ); } catch (error) { print('Error placing order: $error'); // Handle the error appropriately, e.g., show an error message // ... } }, child: Text('Confirm'), ), ], ); }, ); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Order Now', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), ], ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/User_ screens/CustomerDashboard.dart
// ignore_for_file: prefer_const_literals_to_create_immutables, prefer_const_constructors import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_setup/User_%20screens/userProfile.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import './ViewProduct.dart'; import './viewCart.dart'; import './myOrder.dart'; import '../components/AppSignIn.dart'; class CustomerDashboard extends StatelessWidget { final String? userId; final String? username; final String? firstName; final String? lastName; final String? phone; const CustomerDashboard({ super.key, this.userId, this.username, this.firstName, this.lastName, this.phone, }); @override Widget build(BuildContext context) { List<SalesData> salesData = [ SalesData(month: 'Jan', amount: 100), SalesData(month: 'Feb', amount: 800), SalesData(month: 'Mar', amount: 300), SalesData(month: 'May', amount: 500), SalesData(month: 'June', amount: 1000), SalesData(month: 'July', amount: 1200), // Add more data as needed ]; List<charts.Series<SalesData, String>> seriesList = [ charts.Series( id: 'Sales', data: salesData, domainFn: (SalesData sales, _) => sales.month, measureFn: (SalesData sales, _) => sales.amount, colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault, labelAccessorFn: (SalesData sales, _) => '${sales.month}: ${sales.amount}', ), ]; Future<int> fetchProductsCount() async { try { CollectionReference product = FirebaseFirestore.instance.collection('product'); QuerySnapshot snapshot = await product.where('status', isEqualTo: true).get(); print('Product Count with status true: ${snapshot.docs.length}'); return snapshot.docs.length; } catch (error) { print('Error fetching products: $error'); return 0; } } return Scaffold( drawer: MYDraw( userId: userId, firstName: firstName, lastName: lastName, phone: phone, username: username, ), appBar: AppBar( title: Text( 'Dashboard', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: FutureBuilder<int>( future: fetchProductsCount(), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Center(child: CircularProgressIndicator()); } else if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } else { int productCount = snapshot.data ?? 0; return Orders( title: 'Product Available', value: productCount.toString(), color: Colors.green, icon: Icons.shopping_cart, ); } }, ), ), ], ), ), SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: StreamBuilder<QuerySnapshot>( stream: FirebaseFirestore.instance .collection('Orders') .where('UserId', isEqualTo: userId) .snapshots(), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) { if (snapshot.hasError) { return Orders( title: 'Your Orders', value: 'Error', color: Colors.red, icon: Icons.error_outline, ); } if (snapshot.connectionState == ConnectionState.waiting) { return Orders( title: 'Your Orders', value: 'Loading...', color: Colors.blue, icon: Icons.hourglass_empty, ); } final orderCount = snapshot.data!.docs.length; return Orders( title: 'Your Orders', value: orderCount.toString(), color: Colors.orange, icon: Icons.local_mall, ); }, ), ), ], ), ), SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: Orders( title: 'Category', value: '4', color: Color.fromARGB(221, 90, 130, 4), icon: Icons.local_mall, ), ), ], ), ), SizedBox(height: 20), Expanded( child: SizedBox( height: 350, child: charts.BarChart( seriesList, animate: true, vertical: true, ), ), ), ], ), ); } } class SalesData { final String month; final int amount; SalesData({required this.month, required this.amount}); } class Orders extends StatelessWidget { final String title; final String value; final Color color; final IconData icon; const Orders( {super.key, required this.title, required this.value, required this.color, required this.icon}); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), height: 100, width: 350, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: color.withOpacity(0.5), spreadRadius: 5, blurRadius: 7, offset: const Offset(0, 3), ), ], ), child: Row( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon( icon, color: Colors.white, size: 24, ), SizedBox(width: 7), Text( title, style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white), ), ], ), Text( value, style: TextStyle(fontSize: 24, color: Colors.white), ), ], ), ], ), ); } } class StatisticCard extends StatelessWidget { final String title; final String value; final Color color; final IconData icon; const StatisticCard( {super.key, required this.title, required this.value, required this.color, required this.icon}); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), height: 100, width: 150, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: color.withOpacity(0.5), spreadRadius: 5, blurRadius: 7, offset: const Offset(0, 3), ), ], ), child: Row( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon( icon, color: Colors.white, size: 24, ), SizedBox(width: 7), Text( title, style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white), ), ], ), Text( value, style: TextStyle(fontSize: 24, color: Colors.white), ), ], ), SizedBox(width: 7), ], ), ); } } class MYDraw extends StatelessWidget { final String? userId; final String? firstName; final String? lastName; final String? phone; final String? username; const MYDraw({ super.key, this.userId, this.firstName, this.lastName, this.phone, this.username, }); @override Widget build(BuildContext context) { return Drawer( child: ListView( padding: EdgeInsets.zero, children: [ DrawerHeader( decoration: BoxDecoration( color: Colors.blue, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ CircleAvatar( radius: 30, backgroundImage: Image.network( 'https://cdn.pixabay.com/photo/2018/08/28/13/29/avatar-3637561_960_720.png') .image, ), SizedBox(height: 8), Text( '${firstName ?? ""} ${lastName ?? ""}', style: TextStyle( color: Colors.white, fontSize: 18, ), ), SizedBox(height: 8), Text( '$phone', style: TextStyle( color: Colors.white, fontSize: 12, ), ), ], ), ), ListTile( leading: Icon(Icons.dashboard), title: Text('Dashboard'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => CustomerDashboard( userId: userId, firstName: firstName, lastName: lastName, phone: phone, username: username, ), ), ); }, ), ListTile( leading: Icon(Icons.home), title: Text('Products'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => MyHomePage( userId: userId, )), ); }, ), ListTile( leading: Icon(Icons.shopping_cart), title: Text('Cart'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ViewCartPage(), ), ); }, ), ListTile( leading: Icon(Icons.add), title: Text('My Orders'), onTap: () { try { Navigator.push( context, MaterialPageRoute( builder: (context) => MyOrderPage( userId: userId, ), ), ); } catch (e) {} }, ), ListTile( leading: Icon(Icons.list), title: Text('Accounts'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => UserProfilePage( userId: userId, firstName: firstName, lastName: lastName, phone: phone, username: username, ), ), ); }, ), Divider(), ListTile( leading: Icon(Icons.settings), title: Text('Settings'), onTap: () {}, ), ListTile( leading: Icon(Icons.exit_to_app), title: Text('Logout'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => AppSignIn(), ), ); }, ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/User_ screens/userProfile.dart
// profile_page.dart import 'package:flutter/material.dart'; class UserProfilePage extends StatelessWidget { final String? userId; final String? username; final String? firstName; final String? lastName; final String? phone; const UserProfilePage({super.key, this.userId, this.username, this.firstName, this.lastName, this.phone, }); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'User Profile', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ const CircleAvatar( radius: 50, backgroundImage: NetworkImage( 'https://cdn.pixabay.com/photo/2018/08/28/13/29/avatar-3637561_960_720.png', ), ), const SizedBox(height: 16), Text( '$firstName $lastName', style: const TextStyle( fontSize: 24, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 8), const Text( 'Customer', // Assuming this is a role or category, update as needed style: TextStyle( fontSize: 16, color: Colors.grey, ), ), const SizedBox(height: 8), Text( 'Username: ${username ?? ''}', style: const TextStyle( fontSize: 16, color: Colors.grey, ), ), const SizedBox(height: 8), Text( 'Phone: ${phone ?? ''}', style: const TextStyle( fontSize: 16, color: Colors.grey, ), ), const SizedBox(height: 16), Card( elevation: 4, child: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'About Me', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 8), Text( '${firstName ?? ''} ${lastName ?? ''}, customer at the Ecommerce Android Application.', style: const TextStyle( fontSize: 16, ), ), ], ), ), ), ], ), ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/User_ screens/viewCart.dart
import 'dart:convert'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; class ViewCartPage extends StatefulWidget { const ViewCartPage({super.key}); @override _ViewCartPageState createState() => _ViewCartPageState(); } class _ViewCartPageState extends State<ViewCartPage> { List<String> cartItems = []; Future<void> _placeOrder() async { // Save data to a new collection or update an existing one in Firebase for (var item in cartItems) { var itemDetails = item.split(", "); // Extracting details String productId = itemDetails[0].split(": ")[1]; // Extracting productId String productName = itemDetails[1].split(": ")[1]; // Extracting the product name String description = itemDetails[2].split(": ")[1]; // Extracting the description String price = itemDetails[3].split(": ")[1]; // Extracting the price String imageUrl = itemDetails[4].split(": ")[1]; // Extracting the image URL await FirebaseFirestore.instance.collection('Orders').add({ 'UserId': 'jQUY47EaPywbj3zXyQpW', 'ProductId': productId, 'ProductName': productName, 'Description': description, 'Price': price, // Add more fields as needed }); } // Clear SharedPreferences (set the cartProducts key to null) SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.remove('cartProducts'); // Show a success message ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('Order placed successfully!')), ); Navigator.pushReplacement( context, MaterialPageRoute( builder: (BuildContext context) => const ViewCartPage(), ), ); // Navigate to a success page or perform other actions } @override void initState() { super.initState(); _fetchCartItems(); } Future<void> _fetchCartItems() async { SharedPreferences prefs = await SharedPreferences.getInstance(); // Retrieve the stored product data String? storedProductData = prefs.getString('cartProducts'); if (storedProductData != null) { try { // Parse the stored JSON string Map<String, dynamic> productData = json.decode(storedProductData); // Extract the productId and productData separately String productId = productData['productId'] ?? ''; Map<String, dynamic> actualProductData = productData['productData'] ?? {}; // Extract individual product details from productData String productName = actualProductData['ProductName'] ?? ''; String description = actualProductData['Description'] ?? ''; String price = actualProductData['Price'] ?? ''; String category = actualProductData['Catagory'] ?? ''; bool status = actualProductData['status'] ?? false; String item = 'Product ID: $productId, Product: $productName, Description: $description, Price: $price, Category: $category, Status: $status'; setState(() { cartItems.add(item); }); } catch (e) { print('Error parsing JSON: $e'); } } else { // Data doesn't exist in SharedPreferences print('No product data found in SharedPreferences'); } } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'View Cart', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Items in Cart:', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 16), if (cartItems.isEmpty) const Text('Your cart is empty.') else Expanded( child: ListView.builder( itemCount: cartItems.length, itemBuilder: (context, index) { var itemDetails = cartItems[index].split(", "); // Extracting details String productId = itemDetails[0].split(": ")[1]; // Extracting productId String productName = itemDetails[1] .split(": ")[1]; // Extracting the product name String description = itemDetails[2] .split(": ")[1]; // Extracting the description String price = itemDetails[3].split(": ")[1]; // Extracting the price String imageUrl = itemDetails[4] .split(": ")[1]; // Extracting the image URL return Card( child: ListTile( leading: CircleAvatar( backgroundImage: NetworkImage( imageUrl), // Display the product image ), title: Text(productName), // Display the product name subtitle: Text( description), // Display the product description trailing: Text(price), // Display the product price // You can add more details like quantity, etc. ), ); }, ), ), const SizedBox(height: 20), // Aligning the button to the right if (cartItems .isNotEmpty) // Only show the button when cart is not empty Align( alignment: Alignment.centerRight, child: ElevatedButton( onPressed: () { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: const Text('Confirm Order'), content: const Text( 'Are you sure you want to place this order?'), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); // Close the dialog }, child: const Text('Cancel'), ), TextButton( onPressed: () async { // Place the order await _placeOrder(); Navigator.of(context).pop(); // Close the dialog }, child: const Text('Confirm'), ), ], ); }, ); }, child: const Text('Complete Order'), ), ), ], ), ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/User_ screens/Beauty.dart
// ignore_for_file: prefer_const_constructors, sized_box_for_whitespace, avoid_print import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; class Beauty extends StatefulWidget { const Beauty({Key? key}) : super(key: key); @override _BeautyState createState() => _BeautyState(); } class _BeautyState extends State<Beauty> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('Catagory', isEqualTo: 'Beauty'.trim()) .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Women Beauty Product List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ?? 'No description'), Text( '\$${product['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.productSnapshot['ProductName'] ?? 'No name'), ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ?? 'No description'), Text( '\$${widget.productSnapshot['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, child: Text('Add To Cart'), ), ElevatedButton( onPressed: () async { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('Confirm Order'), content: Text('Are you sure you want to place this order?'), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); // Close the dialog }, child: Text('Cancel'), ), TextButton( onPressed: () async { try { // Save data to a new collection or update an existing one await FirebaseFirestore.instance .collection('Orders') .add({ 'UserId':'jQUY47EaPywbj3zXyQpW', // Saving the userId 'ProductId': widget.productSnapshot.id, 'ProductName': widget.productSnapshot['ProductName'], 'Description': widget.productSnapshot['Description'], 'Price': widget.productSnapshot['Price'], // Add more fields as needed }); // Close the dialog Navigator.of(context).pop(); // Show a success message or navigate to a success page ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Order placed successfully!'), backgroundColor: Colors.green, ), ); } catch (error) { print('Error placing order: $error'); // Handle the error appropriately, e.g., show an error message // ... } }, child: Text('Confirm'), ), ], ); }, ); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Order Now', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), ], ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/User_ screens/Clothing.dart
// ignore_for_file: prefer_const_constructors, sized_box_for_whitespace, avoid_print import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; class ClothingProduct extends StatefulWidget { const ClothingProduct({Key? key}) : super(key: key); @override _ClothingProductState createState() => _ClothingProductState(); } class _ClothingProductState extends State<ClothingProduct> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('Catagory', isEqualTo: 'Clothing'.trim()) .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Clothing Products List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ?? 'No description'), Text( '\$${product['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.productSnapshot['ProductName'] ?? 'No name'), ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ?? 'No description'), Text( '\$${widget.productSnapshot['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, child: Text('Add to Cart'), ), ElevatedButton( onPressed: () async { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('Confirm Order'), content: Text('Are you sure you want to place this order?'), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); // Close the dialog }, child: Text('Cancel'), ), TextButton( onPressed: () async { try { // Save data to a new collection or update an existing one await FirebaseFirestore.instance .collection('Orders') .add({ 'UserId':'jQUY47EaPywbj3zXyQpW', // Saving the userId 'ProductId': widget.productSnapshot.id, 'ProductName': widget.productSnapshot['ProductName'], 'Description': widget.productSnapshot['Description'], 'Price': widget.productSnapshot['Price'], // Add more fields as needed }); // Close the dialog Navigator.of(context).pop(); // Show a success message or navigate to a success page ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Order placed successfully!'), backgroundColor: Colors.green, ), ); } catch (error) { print('Error placing order: $error'); // Handle the error appropriately, e.g., show an error message // ... } }, child: Text('Confirm'), ), ], ); }, ); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Order Now', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), ], ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/User_ screens/ViewProduct.dart
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables import 'dart:convert'; import 'package:cloud_firestore/cloud_firestore.dart'; import '../common_widget/PopularMenuUser.dart'; import '../common_widget/TopPromoSlider.dart'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; final String userId; // Add userId variable const ProductDetailPage({ Key? key, required this.productSnapshot, required this.userId, // Include userId in the constructor }) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ?? 'No description'), Text( '\$${widget.productSnapshot['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () async { // Get the SharedPreferences instance SharedPreferences prefs = await SharedPreferences.getInstance(); // Get the current product ID String productId = widget.productSnapshot.id; // Convert the product snapshot data and ID to a JSON object Map<String, dynamic> productMap = { 'productId': productId, 'productData': widget.productSnapshot.data(), }; // Encode the combined data (product ID and product data) to a JSON string String productData = json.encode(productMap); // Store the combined product data in SharedPreferences prefs.setString('cartProducts', productData); // Show a snackbar ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product added to cart')), ); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Add to Cart', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), ElevatedButton( onPressed: () async { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('Confirm Order'), content: Text('Are you sure you want to place this order?'), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); // Close the dialog }, child: Text('Cancel'), ), TextButton( onPressed: () async { try { // Save data to a new collection or update an existing one await FirebaseFirestore.instance .collection('Orders') .add({ 'UserId': widget.userId, // Saving the userId 'ProductId': widget.productSnapshot.id, 'ProductName': widget.productSnapshot['ProductName'], 'Description': widget.productSnapshot['Description'], 'Price': widget.productSnapshot['Price'], // Add more fields as needed }); // Close the dialog Navigator.of(context).pop(); // Show a success message or navigate to a success page ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Order placed successfully!'), backgroundColor: Colors.green, ), ); } catch (error) { print('Error placing order: $error'); // Handle the error appropriately, e.g., show an error message // ... } }, child: Text('Confirm'), ), ], ); }, ); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Order Now', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), ], ), ], ), ); } } class MyHomePage extends StatefulWidget { final String? userId; const MyHomePage({super.key, this.userId}); @override _BrandHomePageState createState() => _BrandHomePageState(); } class _BrandHomePageState extends State<MyHomePage> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Products List', style: TextStyle( color: Colors.white, ), ), iconTheme: IconThemeData(color: Colors.white), backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), TopPromoSlider(), PopularMenu(), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], userId: widget.userId ?? '', // Provide a default empty string if userId is null ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ?? 'No description'), Text( '\$${product['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/User_ screens/myOrder.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; class MyOrderPage extends StatelessWidget { final String? userId; const MyOrderPage({super.key, this.userId}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'My Orders', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: StreamBuilder<QuerySnapshot>( stream: FirebaseFirestore.instance .collection('Orders') .where('UserId', isEqualTo: userId) .snapshots(), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) { if (snapshot.hasError) { return Center( child: Text('Error: ${snapshot.error}'), ); } if (snapshot.connectionState == ConnectionState.waiting) { return const Center( child: CircularProgressIndicator(), ); } final orders = snapshot.data!.docs; if (orders.isEmpty) { return const Center( child: Text('No orders found.'), ); } return ListView.builder( itemCount: orders.length, itemBuilder: (context, index) { final order = orders[index].data() as Map<String, dynamic>; return FutureBuilder<DocumentSnapshot>( future: FirebaseFirestore.instance .collection('product') .doc(order['ProductId']) .get(), builder: (BuildContext context, AsyncSnapshot<DocumentSnapshot> productSnapshot) { if (productSnapshot.connectionState == ConnectionState.waiting) { return const Card( child: ListTile( title: Text('Loading...'), ), ); } if (productSnapshot.hasError) { return Card( child: ListTile( title: Text('Error: ${productSnapshot.error}'), ), ); } final productData = productSnapshot.data!.data() as Map<String, dynamic>; return Card( child: ListTile( title: Text(productData['ProductName']), subtitle: Text('Price: \$${productData['Price']}'), // Display other product details as needed ), ); }, ); }, ); }, ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/Shoes.dart
// ignore_for_file: prefer_const_constructors, sized_box_for_whitespace, avoid_print import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import './EditProduct.dart'; class ShoesProducts extends StatefulWidget { const ShoesProducts({Key? key}) : super(key: key); @override _ShoesProductsState createState() => _ShoesProductsState(); } class _ShoesProductsState extends State<ShoesProducts> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('Catagory', isEqualTo: 'Shoes'.trim()) .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Shoes Product List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'], style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ), Text( '\$${product['Price']}', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.productSnapshot['ProductName'] ?? 'No name'), ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'], style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ), Text( '\$${widget.productSnapshot['Price']}', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, child: Text('Delete'), ), ElevatedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => EditProductScreen( productSnapshot: widget.productSnapshot, ), ), ); }, child: Text('Edit'), ), ], ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/ViewProdect.dart
// ignore_for_file: prefer_const_constructors, sized_box_for_whitespace, avoid_print import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import '../common_widget/PopularMenu.dart'; import './EditProduct.dart'; class ViewProduct extends StatefulWidget { const ViewProduct({Key? key}) : super(key: key); @override _ViewProductState createState() => _ViewProductState(); } class _ViewProductState extends State<ViewProduct> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Product List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), PopularMenu(), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ?? 'No description'), Text( '\$${product['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ?? 'No description'), Text( '\$${widget.productSnapshot['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, child: Text('Delete'), ), ElevatedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => EditProductScreen( productSnapshot: widget.productSnapshot, ), ), ); }, child: Text('Edit'), ), ], ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/AdminDashboard.dart
import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import '../screens/userProfile.dart'; import '../common_widget/PopularMenu.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import './AddProdect.dart'; import './ViewProdect.dart'; import '../components/AppSignIn.dart'; import '../screens/HomeScreen.dart'; import '../screens/orders.dart'; class AdminDashboard extends StatefulWidget { final String? userId; final String? username; final String? firstName; final String? lastName; final String? phone; AdminDashboard({ this.userId, this.username, this.firstName, this.lastName, this.phone, }); @override State<AdminDashboard> createState() => _AdminDashboardState(); } class _AdminDashboardState extends State<AdminDashboard> { int ProductsCount = 0; int AllUserCount = 0; @override void initState() { super.initState(); getInitialCounts(); } Future<void> getInitialCounts() async { ProductsCount = await getProductsCount(); AllUserCount = await UserCount(); setState(() {}); } Future<int> getProductsCount() async { try { CollectionReference product = FirebaseFirestore.instance.collection('product'); QuerySnapshot snapshot = await product.where('status', isEqualTo: true).get(); print('Product Count with status true: ${snapshot.docs.length}'); return snapshot.docs.length; } catch (error) { print('Error fetching products: $error'); return 0; } } Future<int> UserCount() async { try { CollectionReference AllUser = FirebaseFirestore.instance.collection('AllUser'); QuerySnapshot snapshot = await AllUser.get(); return snapshot.docs.length; } catch (error) { print('Error fetching products: $error'); return 0; } } @override Widget build(BuildContext context) { List<SalesData> salesData = [ SalesData(month: 'Jan', amount: 100), SalesData(month: 'Feb', amount: 800), SalesData(month: 'Mar', amount: 300), SalesData(month: 'May', amount: 500), SalesData(month: 'June', amount: 1000), SalesData(month: 'July', amount: 1200), ]; List<charts.Series<SalesData, String>> seriesList = [ charts.Series( id: 'Sales', data: salesData, domainFn: (SalesData sales, _) => sales.month, measureFn: (SalesData sales, _) => sales.amount, colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault, labelAccessorFn: (SalesData sales, _) => '${sales.month}: ${sales.amount}', ), ]; return Scaffold( drawer: MYDraw( userId: widget.userId, firstName: widget.firstName, lastName: widget.lastName, phone: widget.phone, username: widget.username), appBar: AppBar( title: Text( 'Admin Dashboard', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ // Your existing StatisticCard widgets StatisticCard( title: 'Product', value: ProductsCount.toString(), color: Colors.green, icon: Icons.shopping_cart, ), StatisticCard( title: 'Users', value: AllUserCount.toString(), color: Colors.orange, icon: Icons.person, ), ], ), ), SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: StreamBuilder<QuerySnapshot>( stream: FirebaseFirestore.instance .collection('Orders') .snapshots(), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) { if (snapshot.hasError) { return Orders( title: 'Orders', value: 'Error', color: Colors.red, icon: Icons.error_outline, ); } if (snapshot.connectionState == ConnectionState.waiting) { return Orders( title: 'Orders', value: 'Loading...', color: Colors.blue, icon: Icons.hourglass_empty, ); } final orderCount = snapshot.data!.docs.length; return Orders( title: 'Orders', value: orderCount.toString(), color: Colors.orange, icon: Icons.local_mall, ); }, ), ), ], ), ), PopularMenu(), SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Flexible( child: Orders( title: 'Category', value: '5', color: Color.fromARGB(221, 90, 130, 4), icon: Icons.local_mall, ), ), ], ), ), SizedBox(height: 20), Expanded( child: SizedBox( height: 350, child: charts.BarChart( seriesList, animate: true, vertical: true, ), ), ), ], ), ); } } class SalesData { final String month; final int amount; SalesData({required this.month, required this.amount}); } class Orders extends StatelessWidget { final String title; final String value; final Color color; final IconData icon; const Orders( {required this.title, required this.value, required this.color, required this.icon}); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), height: 100, width: 350, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: color.withOpacity(0.5), spreadRadius: 5, blurRadius: 7, offset: const Offset(0, 3), ), ], ), child: Row( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon( icon, color: Colors.white, size: 24, ), SizedBox(width: 7), Text( title, style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white), ), ], ), Text( value, style: TextStyle(fontSize: 24, color: Colors.white), ), ], ), ], ), ); } } class StatisticCard extends StatelessWidget { final String title; final String value; final Color color; final IconData icon; const StatisticCard( {required this.title, required this.value, required this.color, required this.icon}); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), height: 100, width: 150, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: color.withOpacity(0.5), spreadRadius: 5, blurRadius: 7, offset: const Offset(0, 3), ), ], ), child: Row( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon( icon, color: Colors.white, size: 24, ), SizedBox(width: 7), Text( title, style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white), ), ], ), Text( value, style: TextStyle(fontSize: 24, color: Colors.white), ), ], ), SizedBox(width: 7), ], ), ); } } class MYDraw extends StatelessWidget { final String? userId; final String? firstName; final String? lastName; final String? phone; final String? username; MYDraw({ this.userId, this.firstName, this.lastName, this.phone, this.username, }); @override Widget build(BuildContext context) { return Drawer( child: ListView( padding: EdgeInsets.zero, children: [ DrawerHeader( decoration: BoxDecoration( color: Colors.blue, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ CircleAvatar( radius: 30, backgroundImage: Image.network( 'https://cdn.pixabay.com/photo/2018/08/28/13/29/avatar-3637561_960_720.png') .image, ), SizedBox(height: 8), Text( '${firstName ?? ""} ${lastName ?? ""}', style: TextStyle( color: Colors.white, fontSize: 18, ), ), SizedBox(height: 8), Text( '$phone', style: TextStyle( color: Colors.white, fontSize: 12, ), ), ], ), ), ListTile( leading: Icon(Icons.dashboard), title: Text('Dashboard'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => AdminDashboard( firstName: firstName, lastName: lastName, phone: phone, username: username, ), ), ); }, ), ListTile( leading: Icon(Icons.home), title: Text('Home Screen'), onTap: () { Navigator.push( context, MaterialPageRoute(builder: (context) => MyHomePage()), ); }, ), ListTile( leading: Icon(Icons.add), title: Text('Products'), onTap: () { try { Navigator.push( context, MaterialPageRoute( builder: (context) => ViewProduct(), ), ); } catch (e) { print("Navigation error: $e"); } }, ), ListTile( leading: Icon(Icons.list), title: Text('Add Products'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => AddProductScreen(), ), ); }, ), ListTile( leading: Icon(Icons.add), title: Text('Orders'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => MyOrderPage( userId: userId, ), ), ); }, ), // Account product ListTile( leading: Icon(Icons.delete), title: Text('Account'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => UserProfilePage( userId: userId, firstName: firstName, lastName: lastName, phone: phone, username: username, ), ), ); }, ), Divider(), ListTile( leading: Icon(Icons.settings), title: Text('Settings'), onTap: () {}, ), ListTile( leading: Icon(Icons.exit_to_app), title: Text('Logout'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => AppSignIn(), ), ); }, ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/Mobbile.dart
// ignore_for_file: prefer_const_constructors, sized_box_for_whitespace, avoid_print import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import './EditProduct.dart'; class Mobile extends StatefulWidget { const Mobile({Key? key}) : super(key: key); @override _MobileState createState() => _MobileState(); } class _MobileState extends State<Mobile> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('Catagory', isEqualTo: 'Mobbile'.trim()) .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Mobiles Product List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'], style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ), Text( '\$${product['Price']}', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.productSnapshot['ProductName'] ?? 'No name'), ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image']), ), Text( widget.productSnapshot['ProductName'] , style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ), Text( '\$${widget.productSnapshot['Price']}', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, child: Text('Delete'), ), ElevatedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => EditProductScreen( productSnapshot: widget.productSnapshot, ), ), ); }, child: Text('Edit'), ), ], ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/userProfile.dart
// profile_page.dart import 'package:flutter/material.dart'; class UserProfilePage extends StatelessWidget { final String? userId; final String? username; final String? firstName; final String? lastName; final String? phone; const UserProfilePage({super.key, this.userId, this.username, this.firstName, this.lastName, this.phone, }); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'User Profile', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ const CircleAvatar( radius: 50, backgroundImage: NetworkImage( 'https://cdn.pixabay.com/photo/2018/08/28/13/29/avatar-3637561_960_720.png', ), ), const SizedBox(height: 16), Text( '$firstName $lastName', style: const TextStyle( fontSize: 24, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 8), const Text( 'Admin', // Assuming this is a role or category, update as needed style: TextStyle( fontSize: 16, color: Colors.grey, ), ), const SizedBox(height: 8), Text( 'Username: ${username ?? ''}', style: const TextStyle( fontSize: 16, color: Colors.grey, ), ), const SizedBox(height: 8), Text( 'Phone: ${phone ?? ''}', style: const TextStyle( fontSize: 16, color: Colors.grey, ), ), const SizedBox(height: 16), Card( elevation: 4, child: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'About Me', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 8), Text( '${firstName ?? ''} ${lastName ?? ''}, Admin at the Ecommerce Android Application.', style: const TextStyle( fontSize: 16, ), ), ], ), ), ), ], ), ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/Beauty.dart
// ignore_for_file: prefer_const_constructors, sized_box_for_whitespace, avoid_print import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import './EditProduct.dart'; class Beauty extends StatefulWidget { const Beauty({Key? key}) : super(key: key); @override _BeautyState createState() => _BeautyState(); } class _BeautyState extends State<Beauty> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('Catagory', isEqualTo: 'Beauty'.trim()) .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Women Beauty Product List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ?? 'No description'), Text( '\$${product['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.productSnapshot['ProductName'] ?? 'No name'), ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ?? 'No description'), Text( '\$${widget.productSnapshot['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, child: Text('Delete'), ), ElevatedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => EditProductScreen( productSnapshot: widget.productSnapshot, ), ), ); }, child: Text('Edit'), ), ], ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/EditProduct.dart
// edit_product_screen.dart // ignore_for_file: prefer_const_constructors, prefer_final_fields import 'package:firebase_setup/screens/ViewProdect.dart'; import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; class EditProductScreen extends StatefulWidget { final DocumentSnapshot productSnapshot; const EditProductScreen({Key? key, required this.productSnapshot}) : super(key: key); @override _EditProductScreenState createState() => _EditProductScreenState(); } class _EditProductScreenState extends State<EditProductScreen> { late TextEditingController productNameController; late TextEditingController descriptionController; late TextEditingController priceController; late TextEditingController imageController; String defaultFontFamily = 'Roboto-Light.ttf'; double defaultFontSize = 14; double defaultIconSize = 17; GlobalKey<FormState> _formKey = GlobalKey<FormState>(); @override void initState() { super.initState(); // Initialize controllers with existing data productNameController = TextEditingController(text: widget.productSnapshot['ProductName']); descriptionController = TextEditingController(text: widget.productSnapshot['Description']); priceController = TextEditingController(text: widget.productSnapshot['Price'].toString()); // imageController = // TextEditingController(text: widget.productSnapshot['Image']); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Edit Dashboard', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Form( key: _formKey, child: Padding( padding: const EdgeInsets.all(16.0), child: Column( children: [ TextFormField( controller: productNameController, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.production_quantity_limits, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "Enter Product Name", ), validator: (value) { if (value == null || value.isEmpty) { return 'Please enter product name'; } return null; }, ), SizedBox( height: 10, ), TextFormField( controller: priceController, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.price_change_outlined, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "Enter Product Price", ), keyboardType: TextInputType.number, validator: (value) { if (value == null || value.isEmpty) { return 'Please enter product price'; } // You can add more specific validation for price if needed return null; }, ), SizedBox( height: 10, ), TextFormField( controller: descriptionController, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.description, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "Enter Product Description", ), validator: (value) { if (value == null || value.isEmpty) { return 'Please enter product description'; } return null; }, ), SizedBox(height: 20), Image.network( widget.productSnapshot['Image'], height: 200, width: 200, ), SizedBox(height: 16), ElevatedButton( onPressed: () { widget.productSnapshot.reference.update({ 'ProductName': productNameController.text, 'Description': descriptionController.text, 'Price': double.parse(priceController.text), // 'Image': imageController.text, }); ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product updated successfully')), ); Navigator.push( context, MaterialPageRoute( builder: (context) => ViewProduct(), ), ); }, child: Text('Update Product'), ), ], ), ), ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/Clothing.dart
// ignore_for_file: prefer_const_constructors, sized_box_for_whitespace, avoid_print import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import './EditProduct.dart'; class ClothingProduct extends StatefulWidget { const ClothingProduct({Key? key}) : super(key: key); @override _ClothingProductState createState() => _ClothingProductState(); } class _ClothingProductState extends State<ClothingProduct> { late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('Catagory', isEqualTo: 'Clothing'.trim()) .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Clothing Products List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ?? 'No description'), Text( '\$${product['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.productSnapshot['ProductName'] ?? 'No name'), ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ?? 'No description'), Text( '\$${widget.productSnapshot['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, child: Text('Delete'), ), ElevatedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => EditProductScreen( productSnapshot: widget.productSnapshot, ), ), ); }, child: Text('Edit'), ), ], ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/DataBaseFunctions.dart
import 'package:sqflite/sqflite.dart'; import 'package:path/path.dart'; class DbManager { Database? _database; Future openDb() async { _database = await openDatabase( join(await getDatabasesPath(), "sqliteExample.db"), version: 1, onCreate: (Database db, int version) async { await db.execute( "CREATE TABLE Product (id INTEGER PRIMARY KEY autoincrement, ProductName TEXT, Price TEXT, Description TEXT, Image TEXT)", ); }); return _database; } // openDb Future<int?> insertData(Model model) async { await openDb(); int? a = await _database?.insert('Product', model.toJson()); return a; } } class Model { int? id; String? ProdectName; String? Description; String? Price; String? Image; Model({this.id, this.ProdectName, this.Description, this.Price, this.Image}); Model.fromJson(Map<String, dynamic> json) { id = json['id']; ProdectName = json['ProdectName']; Description = json['Description']; Price = json['Price']; Image = json['Image']; } Map<String, dynamic> toJson() { return { 'id': id, 'ProdectName': ProdectName, 'Description': Description, 'Price': Price, 'Image': Image }; } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/AddProdect.dart
// ignore_for_file: use_build_context_synchronously, prefer_const_constructors, non_constant_identifier_names, prefer_const_literals_to_create_immutables, prefer_final_fields import 'dart:io'; import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:image_picker/image_picker.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:shared_preferences/shared_preferences.dart'; import './DataBaseFunctions.dart'; import 'package:flutter/foundation.dart' show kIsWeb; class AddProductScreen extends StatefulWidget { const AddProductScreen({super.key}); @override _AddProductScreenState createState() => _AddProductScreenState(); } class _AddProductScreenState extends State<AddProductScreen> { final TextEditingController _nameController = TextEditingController(); final TextEditingController _priceController = TextEditingController(); final TextEditingController _descriptionController = TextEditingController(); final TextEditingController CatagoeryController = TextEditingController(); String defaultFontFamily = 'Roboto-Light.ttf'; double defaultFontSize = 14; double defaultIconSize = 17; GlobalKey<FormState> _formKey = GlobalKey<FormState>(); final picker = ImagePicker(); File? _image; String ImageUrl = ''; String UploadUrl = ''; Future<void> _pickImage() async { final pickedFile = await picker.pickImage(source: ImageSource.gallery); if (pickedFile != null) { setState(() { _image = File(pickedFile.path); print(_image!.path); ImageUrl = pickedFile.path; // Remove this line }); } else { print('No image selected.'); } } Future<void> UploadImage(File localFile, String imageName) async { try { print('Uploading file: ${localFile.path}'); final FirebaseStorageReference = FirebaseStorage.instance.ref().child('product/$imageName.jpg'); print('Storage reference: ${FirebaseStorageReference.fullPath}'); await FirebaseStorageReference.putFile(localFile); final url = await FirebaseStorageReference.getDownloadURL(); setState(() { UploadUrl = url; }); } catch (e) { print('Error uploading image: $e'); } } Future<void> pickerandupload() async { await _pickImage(); if (_image != null) { String imageName = DateTime.now().millisecondsSinceEpoch.toString(); await UploadImage(_image!, imageName); } else { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Please pick an image first'), duration: Duration(seconds: 2), ), ); } } Future<void> _addProduct() async { if (_formKey.currentState?.validate() ?? false) { try { if (UploadUrl.isNotEmpty) { print('Uploading file: $UploadUrl'); } FirebaseFirestore firestore = FirebaseFirestore.instance; await firestore.collection('product').add({ 'ProductName': _nameController.text, 'Price': _priceController.text, 'Description': _descriptionController.text, 'Image': UploadUrl, 'status': true, 'Catagory': SelectedItem.trim(), }); _Adding_Data_Using_Sheard_Prefrenes(); _Adding_Data_Using_Sqlite(); _nameController.clear(); _priceController.clear(); _descriptionController.clear(); _image = null; showAboutDialog( context: context, applicationName: 'Product Added', applicationVersion: '1.0.0', applicationIcon: Icon(Icons.add), children: [ Text('Product Added Successfully'), ], ); } catch (e) { print('Error adding product: $e'); } } } Future<void> _Adding_Data_Using_Sqlite() async { // Create a Model instance with the data you want to save Model newProduct = Model( ProdectName: _nameController.text, Price: _priceController.text, Description: _descriptionController.text, Image: UploadUrl, ); // Create a DbManager instance DbManager dbManager = DbManager(); int? result = await dbManager.insertData(newProduct); if (result != null && result > 0) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Product added successfully'), duration: Duration(seconds: 2), ), ); } else { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Failed to add product'), duration: Duration(seconds: 2), ), ); } } Future<void> _Adding_Data_Using_Sheard_Prefrenes() async { if (_formKey.currentState?.validate() ?? false) { try { if (UploadUrl.isNotEmpty) { print('Uploading file: $UploadUrl'); } SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.setString('ProductName', _nameController.text); await prefs.setString('Price', _priceController.text); await prefs.setString('Description', _descriptionController.text); await prefs.setString('Image', UploadUrl); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Product added successfully'), duration: Duration(seconds: 10), ), ); } catch (e) { print('Error adding product: $e'); } } } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Add Product', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Form( key: _formKey, child: Padding( padding: const EdgeInsets.all(16.0), child: Column( children: [ TextFormField( controller: _nameController, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.production_quantity_limits, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "Enter Product Name", ), validator: (value) { if (value == null || value.isEmpty) { return '*Please enter product name'; } return null; }, ), SizedBox( height: 10, ), TextFormField( controller: _priceController, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.price_change_outlined, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "Enter Product Price", ), keyboardType: TextInputType.number, validator: (value) { if (value == null || value.isEmpty) { return '*Please enter product price'; } // You can add more specific validation for price if needed return null; }, ), SizedBox( height: 10, ), TextFormField( controller: _descriptionController, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.description, color: Color(0xFF666666), size: defaultIconSize, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: defaultFontFamily, fontSize: defaultFontSize, ), hintText: "Enter Product Description", ), validator: (value) { if (value == null || value.isEmpty) { return '*Please enter product description'; } return null; }, ), SizedBox( height: 10, ), DropdownMenuExample(), SizedBox( height: 10, ), ElevatedButton( onPressed: () { pickerandupload(); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Pick Image and upload', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), SizedBox(height: 20), Container( width: 100, // or any size you want height: 100, // or any size you want decoration: BoxDecoration( border: Border.all(color: Colors.grey), ), child: kIsWeb // Check if running on web ? Center( child: Text('Image preview not available on web'), ) : _image != null ? Image.file(_image!, fit: BoxFit.cover) // Load local file : Icon(Icons.image, size: 50, color: Colors.grey), ), SizedBox(height: 20), ElevatedButton( onPressed: _addProduct, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Add Product', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), ], ), ), ), ); } } const List<String> list = <String>[ ' Select Catagory', ' Clothing', ' Shoes', ' Mobbile', ' Beauty', ]; var SelectedItem = ''; class DropdownMenuExample extends StatefulWidget { const DropdownMenuExample({super.key}); @override State<DropdownMenuExample> createState() => _DropdownMenuExampleState(); } class _DropdownMenuExampleState extends State<DropdownMenuExample> { String dropdownValue = list.first; @override Widget build(BuildContext context) { return DropdownMenu<String>( initialSelection: list.first, onSelected: (String? value) { // This is called when the user selects an item. setState(() { dropdownValue = value!; SelectedItem = dropdownValue; }); }, dropdownMenuEntries: list.map<DropdownMenuEntry<String>>((String value) { return DropdownMenuEntry<String>(value: value, label: value); }).toList(), width: 350, ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/orders.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; class MyOrderPage extends StatelessWidget { final String? userId; const MyOrderPage({super.key, this.userId}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Orders', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: StreamBuilder<QuerySnapshot>( stream: FirebaseFirestore.instance .collection('Orders') .snapshots(), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) { if (snapshot.hasError) { return Center( child: Text('Error: ${snapshot.error}'), ); } if (snapshot.connectionState == ConnectionState.waiting) { return const Center( child: CircularProgressIndicator(), ); } final orders = snapshot.data!.docs; if (orders.isEmpty) { return const Center( child: Text('No orders found.'), ); } return ListView.builder( itemCount: orders.length, itemBuilder: (context, index) { final order = orders[index].data() as Map<String, dynamic>; return FutureBuilder<DocumentSnapshot>( future: FirebaseFirestore.instance .collection('product') .doc(order['ProductId']) .get(), builder: (BuildContext context, AsyncSnapshot<DocumentSnapshot> productSnapshot) { if (productSnapshot.connectionState == ConnectionState.waiting) { return const Card( child: ListTile( title: Text('Loading...'), ), ); } if (productSnapshot.hasError) { return Card( child: ListTile( title: Text('Error: ${productSnapshot.error}'), ), ); } final productData = productSnapshot.data!.data() as Map<String, dynamic>; return Card( child: ListTile( title: Text(productData['ProductName']), subtitle: Text('Price: \$${productData['Price']}'), // Display other product details as needed ), ); }, ); }, ); }, ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App/lib
mirrored_repositories/E_Commerce_Flutter_App/lib/screens/HomeScreen.dart
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_setup/screens/EditProduct.dart'; import 'package:flutter/material.dart'; import '../common_widget/TopPromoSlider.dart'; import '../common_widget/PopularMenu.dart'; import './AdminDashboard.dart'; import './AddProdect.dart'; import './ViewProdect.dart'; import '../components/AppSignIn.dart'; class ProductDetailPage extends StatefulWidget { final DocumentSnapshot productSnapshot; const ProductDetailPage({Key? key, required this.productSnapshot}) : super(key: key); @override _ProductDetailPageState createState() => _ProductDetailPageState(); } class _ProductDetailPageState extends State<ProductDetailPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, ), body: Column( children: [ Expanded( child: Image.network(widget.productSnapshot['Image'] ?? ''), ), Text( widget.productSnapshot['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(widget.productSnapshot['Description'] ?? 'No description'), Text( '\$${widget.productSnapshot['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Update product status to false widget.productSnapshot.reference.update({'status': false}); // Show a success message ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Product deleted successfully')), ); // Navigate back after update Navigator.pop(context); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Delete', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), ElevatedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => EditProductScreen( productSnapshot: widget.productSnapshot, ), ), ); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all<Color>(Colors.blueAccent), ), child: Text( 'Edit', style: TextStyle( color: Colors.white, // Other text style properties if needed ), ), ), ], ), ], ), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key}); @override _BrandHomePageState createState() => _BrandHomePageState(); } class _BrandHomePageState extends State<MyHomePage> { List<dynamic> products = []; TextEditingController searchController = TextEditingController(); Future<void> fetchProductsFromFirebase() async { try { QuerySnapshot querySnapshot = await FirebaseFirestore.instance.collection('product').get(); setState(() { products = querySnapshot.docs.map((doc) { Map<String, dynamic> data = doc.data() as Map<String, dynamic>; // Check if the 'Image' field is empty or null if (data['Image'] == null || data['Image'].isEmpty) { data['Image'] = 'Image not available'; } return data; }).toList(); }); } catch (e) { print('Error fetching products: $e'); // Handle the error here } } late Stream<QuerySnapshot> productsStream; @override void initState() { super.initState(); productsStream = FirebaseFirestore.instance .collection('product') .where('status', isEqualTo: true) .snapshots(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Products List', style: TextStyle( color: Colors.white, // Set text color to white ), ), iconTheme: IconThemeData(color: Colors.white), // Update the icon color backgroundColor: Colors.blueAccent, leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.pop(context); }, ), ), body: Column( children: [ Padding( padding: const EdgeInsets.all(16.0), child: TextField( showCursor: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide( width: 0, style: BorderStyle.none, ), ), filled: true, prefixIcon: Icon( Icons.search, color: Color(0xFF666666), size: 17, ), fillColor: Color(0xFFF2F3F5), hintStyle: TextStyle( color: Color(0xFF666666), fontFamily: 'Roboto-Light.ttf', fontSize: 14, ), hintText: "What would you like to buy?", ), ), ), TopPromoSlider(), PopularMenu(), StreamBuilder<QuerySnapshot>( stream: productsStream, builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } final documents = snapshot.data!.docs; return Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, childAspectRatio: 0.75, ), itemCount: documents.length, itemBuilder: (context, index) { final product = documents[index].data() as Map<String, dynamic>; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ProductDetailPage( productSnapshot: documents[index], ), ), ); }, child: Card( child: Column( children: [ Expanded( child: Image.network(product['Image']), ), Text( product['ProductName'] ?? 'No name', style: TextStyle(fontWeight: FontWeight.bold), ), Text(product['Description'] ?? 'No description'), Text( '\$${product['Price']}' ?? 'No price', style: TextStyle(fontWeight: FontWeight.bold), ), ], ), ), ); }, ), ); }, ), ], ), ); } } class MYDraw extends StatelessWidget { const MYDraw({super.key}); @override Widget build(BuildContext context) { return Drawer( child: ListView( padding: EdgeInsets.zero, children: [ DrawerHeader( decoration: BoxDecoration( color: Colors.blue, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ CircleAvatar( radius: 30, backgroundImage: Image.network( 'https://cdn.pixabay.com/photo/2018/08/28/13/29/avatar-3637561_960_720.png') .image, ), SizedBox(height: 8), Text( 'Saleem Malik', style: TextStyle( color: Colors.white, fontSize: 18, ), ), SizedBox(height: 8), Text( 'saleemalik444@gmail.com', style: TextStyle( color: Colors.white, fontSize: 12, ), ), ], ), ), ListTile( leading: Icon(Icons.dashboard), title: Text('Dashboard'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => AdminDashboard(), ), ); }, ), ListTile( leading: Icon(Icons.add), title: Text('Add Product'), onTap: () { try { Navigator.push( context, MaterialPageRoute( builder: (context) => AddProductScreen(), ), ); } catch (e) { } }, ), ListTile( leading: Icon(Icons.list), title: Text('View Products'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ViewProduct(), ), ); }, ), // edit Prodct ListTile( leading: Icon(Icons.edit), title: Text('Edit Product'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ViewProduct(), ), ); }, ), // delete product ListTile( leading: Icon(Icons.delete), title: Text('Delete Product'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ViewProduct(), ), ); }, ), Divider(), ListTile( leading: Icon(Icons.settings), title: Text('Settings'), onTap: () {}, ), ListTile( leading: Icon(Icons.exit_to_app), title: Text('Logout'), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => AppSignIn(), ), ); }, ), ], ), ); } }
0
mirrored_repositories/E_Commerce_Flutter_App
mirrored_repositories/E_Commerce_Flutter_App/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:firebase_setup/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/people_counter_flutter_app/contador_pessoas_app
mirrored_repositories/people_counter_flutter_app/contador_pessoas_app/lib/main.dart
import 'package:flutter/material.dart'; import 'dart:ui'; void main() { runApp(new MaterialApp( title: 'Contador de Pessoas', home: Home() )); } class Home extends StatefulWidget { @override _HomeState createState() => _HomeState(); } class _HomeState extends State<Home> { int _people = 0; String _msg = "Pode Entrar!"; void _changePeople( int n){ setState(() { if(_people < 20){ _people += n; } else if( n < 0){ _people += n; } }); } void _stateRestaurant(int n){ if(n<0) { setState(() { _msg = "Como tem menos gente? "; }); }else if((n>=15) && (n<20)){ _msg = "Quase lotado!"; }else if(n>=20){ _msg = "Restaurante já está lotado!"; }else{ _msg = "Pode entrar!"; } } @override Widget build(BuildContext context) { return Stack( children: <Widget>[ Image.asset("images/restaurant.jpg", fit: BoxFit.cover, height: 1000.0,), Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text("Pessoas: $_people" , style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 40.0)), Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Padding( padding: EdgeInsets.all(10.0), child: FlatButton( child: Text( "-1", style: TextStyle(color: Colors.white, fontSize: 40.0), ), onPressed: () { _changePeople(-1); _stateRestaurant(_people); debugPrint("$_people"); }, ), ), Padding( padding: EdgeInsets.all(10.0), child: FlatButton( child: Text( "+1", style: TextStyle(color: Colors.white, fontSize: 40.0), ), onPressed: () { _changePeople(1); _stateRestaurant(_people); debugPrint("$_people"); }, ), ), ], ), Text( _msg, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontStyle: FontStyle.italic, fontSize: 20.0)), ], ), ], ); } }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Introduction Page
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Introduction Page/lib/main.dart
import 'package:flutter/material.dart'; import 'package:lottie/lottie.dart'; import 'package:introduction_screen/introduction_screen.dart'; void main(){ runApp(MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( body: SafeArea( child: Center( child:IntroductionScreen( showNextButton: false, done: const Text("Done"), onDone: () {// On button pressed }, pages: [ PageViewModel( // decoration: PageDecoration(boxDecoration: BoxDecoration(gradient: LinearGradient(begin: Alignment.bottomLeft, end: Alignment.topRight, colors: [Colors.grey.withOpacity(.5), Colors.grey.withOpacity(.1)]))), title: "Best Ingredients", body: "Our Promise is to Use Fresh, Health and the Best Picked Ingredients ", image: Center( child: Lottie.network('https://assets6.lottiefiles.com/packages/lf20_p1bmwqtk.json'), ), ), PageViewModel( title: "Chef", body: "We Gathered the Best Chefs From Around the World to Make Sure That We Deliver The best Food to Our Customers", image: Center( child: Lottie.network('https://assets6.lottiefiles.com/packages/lf20_jBvjF3.json'), ), ), PageViewModel( title: "Delivery", body: "No Matter How Far You Are, We Deliver it in a Matter of Second", image: Center( child: Lottie.network('https://assets6.lottiefiles.com/private_files/lf30_ewzbzcaw.json'), ), ), PageViewModel( title: "Enjoy", body: "Enjoy the Pizza, With the Best Ingredients, Cooked by the Best Chefs in the World", image: Center( child: Lottie.network('https://assets6.lottiefiles.com/packages/lf20_rXwz8k6MJO.json'), ), ), ], ) ), ), ), )); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Introduction Page
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Introduction Page/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:on_boarding_page/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Leaflet Map - Drawing a Polygon
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Leaflet Map - Drawing a Polygon/lib/main.dart
import 'package:flutter/material.dart'; import 'package:latlong2/latlong.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/plugin_api.dart'; void main(){ runApp(MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: MyHomePage() ); } } class MyHomePage extends StatefulWidget { const MyHomePage({Key? key}) : super(key: key); @override State<MyHomePage> createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { List<Polygon> Polygons = [ Polygon(points: [LatLng(51.5251217665913, -0.08750429301284157), LatLng(51.52472895081553, -0.08759899699452944), LatLng(51.52334424817988, -0.08734645304377864), LatLng(51.52229341736876, -0.08707812509587143), LatLng(51.52165505036376, -0.0870465571028376), LatLng(51.52059435924525, -0.08723596506618492), LatLng(51.52045686043991, -0.08723596506618492), LatLng( 51.52025061145315, -0.08523139745747699), LatLng(51.52126220468193, -0.0848367975335691), LatLng(51.521213098733455, -0.08355829378393764), LatLng(51.52200860857974, -0.08332153382906426)], color: Colors.redAccent, isFilled: true ) ]; @override Widget build(BuildContext context) { return Scaffold( body: Column( children: [ SizedBox( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, child: FlutterMap( options: MapOptions( center: LatLng(51.5251217665913, -0.08750429301284157), zoom: 14 ), nonRotatedChildren: [ AttributionWidget.defaultWidget(source: 'OpenStreetMap contributers', onSourceTapped: null), ], children: [ TileLayer( urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', userAgentPackageName: 'com.example.app', ), PolygonLayer( polygons: Polygons.sublist(0), ) ], ), ) ], ) ); } } // [LatLng(51.5251217665913, -0.08750429301284157)] // // // [LatLng(51.5251217665913, -0.08750429301284157), LatLng(51.52472895081553, -0.08759899699452944), LatLng(51.52334424817988, -0.08734645304377864), LatLng(51.52229341736876, -0.08707812509587143), LatLng(51.52165505036376, -0.0870465571028376), LatLng(51.52059435924525, -0.08723596506618492), LatLng(51.52045686043991, -0.08723596506618492), LatLng( 51.52025061145315, -0.08523139745747699), LatLng(51.52126220468193, -0.0848367975335691), LatLng(51.521213098733455, -0.08355829378393764), LatLng(51.52200860857974, -0.08332153382906426)] // // // // // LatLng(51.523652775033895, -0.07691958874553961), LatLng(51.52367072739264, -0.07517395592805087), LatLng(51.52374759498451, -0.07456489264279753), LatLng( 51.52407252506501, -0.0735038380923072), LatLng( 51.525200571796205, -0.07092957119888865), LatLng(51.52557083986238, -0.0701268435088025), LatLng(51.52603223592109, -0.06802406148216278)]
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Leaflet Map - Drawing a Polygon
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Leaflet Map - Drawing a Polygon/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:poly_line/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Animated Text - Flutter Floating Text - Flutter Wavy Text Animation
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Animated Text - Flutter Floating Text - Flutter Wavy Text Animation/lib/main.dart
import 'package:flutter/material.dart'; import 'package:animated_text_kit/animated_text_kit.dart'; void main(){ runApp(MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: MyHomePage(), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({Key? key}) : super(key: key); @override State<MyHomePage> createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.grey[300], body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ newContainer1(50), SizedBox(height: 20,), newContainer2(50), ], ), ), ); } } Widget newContainer1(double r){ return Container( height: 250, width: 250, child: Center( child: DefaultTextStyle( style: const TextStyle( fontSize: 20, color: Colors.black ), child: AnimatedTextKit( animatedTexts: [ WavyAnimatedText('Hello World'), WavyAnimatedText('Make It Happen'), ], isRepeatingAnimation: true, ), ), ), decoration: BoxDecoration( color: Colors.grey[300], borderRadius: BorderRadius.all(Radius.circular(r)), boxShadow: [ BoxShadow( color: (Colors.grey[500])!, offset: Offset(-4, -4), blurRadius: 15, spreadRadius: 1 ), BoxShadow( color: (Colors.white)!, offset: Offset(4, 4), blurRadius: 15, spreadRadius: 1 ), ]), ); } Widget newContainer2(double r){ return Container( height: 250, width: 250, child: Center( child: DefaultTextStyle( style: const TextStyle( fontSize: 50, color: Colors.black ), child: AnimatedTextKit( animatedTexts: [ ScaleAnimatedText('Make'), ScaleAnimatedText('It'), ScaleAnimatedText('Happen') ], ), ), ), decoration: BoxDecoration( color: Colors.grey[300], borderRadius: BorderRadius.all(Radius.circular(r)), boxShadow: [ BoxShadow( color: (Colors.grey[500])!, offset: Offset(-4, -4), blurRadius: 15, spreadRadius: 1 ), BoxShadow( color: (Colors.white)!, offset: Offset(4, 4), blurRadius: 15, spreadRadius: 1 ), ]), ); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Animated Text - Flutter Floating Text - Flutter Wavy Text Animation
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Animated Text - Flutter Floating Text - Flutter Wavy Text Animation/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:liquid_neumorphic/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Text Field
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Text Field/lib/myInput.dart
import 'package:flutter/material.dart'; class myInput extends StatefulWidget { final controler; final String hint; const myInput({ super.key, required this.controler, required this.hint, }); @override State<myInput> createState() => _myInputState(); } class _myInputState extends State<myInput> { @override Widget build(BuildContext context) { return TextField( controller: widget.controler, decoration: InputDecoration( enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.white) ), focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.white) ), fillColor: Colors.white, filled: true, hintText: widget.hint, hintStyle: TextStyle(color: Colors.grey[500]) ), ); } }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Text Field
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Text Field/lib/main.dart
import 'package:flutter/material.dart'; import 'myInput.dart'; void main(){ runApp(MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: MyHomePage(), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({Key? key}) : super(key: key); @override State<MyHomePage> createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { final start = TextEditingController(); final end = TextEditingController(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Text Field', style: TextStyle(fontWeight: FontWeight.w600, fontSize: 15),), backgroundColor: Colors.grey[500],), backgroundColor: Colors.grey[300], body: Padding( padding: const EdgeInsets.all(15.0), child: SafeArea( child: Column( children: [ myInput(controler: start, hint: 'Starting'), SizedBox(height: 15,), myInput(controler: end, hint: 'Ending'), SizedBox(height: 10,), ElevatedButton( style: ElevatedButton.styleFrom(backgroundColor: Colors.grey[500]), onPressed: (){ setState(() { print(start.text); print(end.text); }); }, child: Text('Press to Print')) ], ), ), ), ); } }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Text Field
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Text Field/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:text_input/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter fl_chart - Flutter line chart (line graph)
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter fl_chart - Flutter line chart (line graph)/lib/main.dart
import 'package:flutter/material.dart'; import 'package:fl_chart/fl_chart.dart'; void main(){ runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: MyHomePage(), ); } } class MyHomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black12, appBar: AppBar(title: Text('Line Chart'), centerTitle: true, backgroundColor: Colors.black12,), body: SingleChildScrollView( child: Container( color: Colors.black12, height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, child: LineChartWidget(), ), ), ); } } class Titles{ static getTitleData() => FlTitlesData( show: true, bottomTitles: SideTitles( showTitles: true, reservedSize: 35, getTextStyles: (value) => const TextStyle( fontSize: 16, fontWeight: FontWeight.bold, color: Colors.grey), getTitles: (value) { switch (value.toInt()){ case 2: return '2020'; case 5: return '2021'; case 8: return '2022'; } return ''; }, margin: 5, ), leftTitles: SideTitles( showTitles: true, getTextStyles: (value) => const TextStyle( color: Colors.grey, fontWeight: FontWeight.bold,fontSize: 13, ), getTitles: (value){ switch (value.toInt()){ case 10000: return '10k'; case 20000: return '20k'; case 30000: return '30k'; case 40000: return '40k'; case 50000: return '50k'; case 60000: return '60k'; case 70000: return '70k'; } return ''; }, reservedSize: 35, margin: 5 ) ); } class LineChartWidget extends StatelessWidget { final List<Color> gradiantColors = [ Colors.redAccent, Colors.orangeAccent ]; @override Widget build(BuildContext context) { return LineChart( LineChartData( minX: 0, maxX: 11, minY: 0, maxY: 70000, titlesData: Titles.getTitleData(), gridData: FlGridData( show: true, getDrawingHorizontalLine: (value){ return FlLine( color: Colors.grey[800], strokeWidth: 1 ); }, ), borderData: FlBorderData( show: true, border: Border.all(color: Colors.grey[800], width: 2) ), lineBarsData: [ LineChartBarData( spots: [ FlSpot(0,30000), FlSpot(2.5,10000), FlSpot(4,50000), FlSpot(6,43000), FlSpot(8,40000), FlSpot(9,30000), FlSpot(11,38000), ], isCurved: true, colors: gradiantColors, barWidth: 3, belowBarData: BarAreaData( show: true, colors: gradiantColors.map((color) => color.withOpacity(.4)).toList() ) ) ] ) ); } }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter fl_chart - Flutter line chart (line graph)
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter fl_chart - Flutter line chart (line graph)/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:chart1/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Routing Map Leaflet
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Routing Map Leaflet/lib/myInput.dart
import 'package:flutter/material.dart'; class myInput extends StatefulWidget { final controler; final String hint; const myInput({ super.key, required this.controler, required this.hint, }); @override State<myInput> createState() => _myInputState(); } class _myInputState extends State<myInput> { @override Widget build(BuildContext context) { return TextField( controller: widget.controler, decoration: InputDecoration( enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.white), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.white) ), fillColor: Colors.white, filled: true, hintText: widget.hint, hintStyle: TextStyle(color: Colors.grey[500]), ), ); } }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Routing Map Leaflet
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Routing Map Leaflet/lib/main.dart
import 'package:flutter/material.dart'; import 'package:geocoding/geocoding.dart'; import 'myInput.dart'; import 'package:latlong2/latlong.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/plugin_api.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; void main(){ runApp(MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: MyHomePage(), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({Key? key}) : super(key: key); @override State<MyHomePage> createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { final start = TextEditingController(); final end = TextEditingController(); bool isVisible = false; List<LatLng> routpoints = [LatLng(52.05884, -1.345583)]; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Routing', style: TextStyle(fontSize: 20, fontWeight: FontWeight.w700),),backgroundColor: Colors.grey[500],), backgroundColor: Colors.grey[300], body: SafeArea( child: Padding( padding: const EdgeInsets.all(12.0), child: SingleChildScrollView( child: Column( children: [ myInput(controler: start, hint: 'Enter Starting PostCode'), SizedBox(height: 15,), myInput(controler: end, hint: 'Enter Ending PostCode'), SizedBox(height: 15,), ElevatedButton( style: ElevatedButton.styleFrom(backgroundColor: Colors.grey[500]), onPressed: () async{ List<Location> start_l = await locationFromAddress(start.text); List<Location> end_l = await locationFromAddress(end.text); var v1 = start_l[0].latitude; var v2 = start_l[0].longitude; var v3 = end_l[0].latitude; var v4 = end_l[0].longitude; var url = Uri.parse('http://router.project-osrm.org/route/v1/driving/$v2,$v1;$v4,$v3?steps=true&annotations=true&geometries=geojson&overview=full'); var response = await http.get(url); print(response.body); setState(() { routpoints = []; var ruter = jsonDecode(response.body)['routes'][0]['geometry']['coordinates']; for(int i=0; i< ruter.length; i++){ var reep = ruter[i].toString(); reep = reep.replaceAll("[",""); reep = reep.replaceAll("]",""); var lat1 = reep.split(','); var long1 = reep.split(","); routpoints.add(LatLng( double.parse(lat1[1]), double.parse(long1[0]))); } isVisible = !isVisible; print(routpoints); }); }, child: Text('Press')), SizedBox(height: 10,), SizedBox( height: 500, width: 400, child: Visibility( visible: isVisible, child: FlutterMap(options: MapOptions( center: routpoints[0], zoom: 10, ), nonRotatedChildren: [ AttributionWidget.defaultWidget(source: 'OpenStreetMap contributors', onSourceTapped: null), ], children: [ TileLayer( urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', userAgentPackageName: 'com.example.app', ), PolylineLayer( polylineCulling: false, polylines: [ Polyline(points: routpoints, color: Colors.blue, strokeWidth: 9) ], ) ], ), ), ), ], ), ), ), ), ); } }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Routing Map Leaflet
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Routing Map Leaflet/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:route_between_two_points/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter fl_chart - Flutter animated line chart (animated line graph)
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter fl_chart - Flutter animated line chart (animated line graph)/lib/main.dart
import 'dart:async'; import 'dart:math' as math; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; void main(){ runApp(MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: MyHomePage(), ); } } class MyHomePage extends StatelessWidget { const MyHomePage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.blueGrey[900], body: Center( child: Container( color: Colors.blueGrey[900], height: 450, width: 400, child: MyLineChart() , ), ), ); } } class MyLineChart extends StatefulWidget { const MyLineChart({Key? key}) : super(key: key); final Color sinColor = Colors.blue; final Color cosColor = Colors.pink; @override State<MyLineChart> createState() => _MyLineChartState(); } class _MyLineChartState extends State<MyLineChart> { final limitCount = 100; final sinPoints = <FlSpot>[]; final cosPoints = <FlSpot>[]; double X = 0; double step = .05; late Timer timer; @override void initState(){ super.initState(); timer = Timer.periodic(const Duration(milliseconds: 40), (timer) { while (sinPoints.length > limitCount){ sinPoints.removeAt(0); cosPoints.removeAt(0); } setState(() { sinPoints.add(FlSpot(X, .5*math.sin(20*X) + .5*math.sin(5*X))); cosPoints.add(FlSpot(X, math.cos(X))); }); X+= step; }); } @override Widget build(BuildContext context) { return cosPoints.isNotEmpty ? Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const SizedBox(height: 15), Text( 'X:${X.toStringAsFixed(1)}', style: const TextStyle( color: Colors.grey, fontSize: 20, fontWeight: FontWeight.bold, ), ), Text( '.5Sin(20X) + .5sin(5*x):${sinPoints.last.y.toStringAsFixed(1)}', style: const TextStyle( color: Colors.grey, fontSize: 20, fontWeight: FontWeight.bold, ), ), Text( 'cos(X):${cosPoints.last.y.toStringAsFixed(1)}', style: const TextStyle( color: Colors.grey, fontSize: 20, fontWeight: FontWeight.bold, ), ), SizedBox(height: 20), AspectRatio(aspectRatio: 1.5, child: Padding( padding: const EdgeInsets.only(bottom: 25), child: LineChart( LineChartData( minY: -1, maxY: 1, minX: sinPoints.first.x, maxX: sinPoints.last.x, lineTouchData: LineTouchData(enabled: false), clipData: FlClipData.all(), gridData: FlGridData(show: true), borderData: FlBorderData(show: false), lineBarsData: [ sinLine(sinPoints), cosLine(cosPoints), ], titlesData: FlTitlesData(show: false), ) ), ), ) ], ): Container(); } LineChartBarData sinLine(List<FlSpot> points){ return LineChartBarData( spots: points, dotData:FlDotData(show: false), gradient: LinearGradient( colors: [widget.sinColor.withOpacity(0), widget.sinColor], stops: const [.1, 1], ), barWidth: 5, isCurved: false, ); } LineChartBarData cosLine(List<FlSpot> points){ return LineChartBarData( spots: points, dotData:FlDotData(show: false), gradient: LinearGradient( colors: [widget.cosColor.withOpacity(0), widget.cosColor], stops: const [.1, 1], ), barWidth: 5, isCurved: false, ); } @override void dispose(){ timer.cancel(); super.dispose(); } }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter 2Pac Music Playlist (just_audio)
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter 2Pac Music Playlist (just_audio)/lib/main.dart
// // https://w0.peakpx.com/wallpaper/64/34/HD-wallpaper-tupac-discover-more-2pac-hip-hop-rap-rapper-tupac-in-2022-tupac-hip-hop-poster-tupac-tupac-art.jpg // // import 'package:flutter/material.dart'; // import 'package:just_audio/just_audio.dart'; // // // // // void main(){ // runApp(MaterialApp( // debugShowCheckedModeBanner: false, // home: Scaffold( // appBar: AppBar( // centerTitle: true, // title: Text( // '2Pac', // style: TextStyle(fontWeight: FontWeight.w900, fontSize: 50, fontFamily: 'DancingScript'), // ), // backgroundColor: Color(0xff230C33), // ), // body: // Container( // decoration: BoxDecoration( // image: DecorationImage(image: NetworkImage('https://w0.peakpx.com/wallpaper/64/34/HD-wallpaper-tupac-discover-more-2pac-hip-hop-rap-rapper-tupac-in-2022-tupac-hip-hop-poster-tupac-tupac-art.jpg'), fit: BoxFit.cover) // ), // child: // Container(child: // Container( // decoration: BoxDecoration( // gradient: LinearGradient(begin: Alignment.bottomCenter, colors: [Colors.black.withOpacity(.3), Colors.black.withOpacity(.1)]) // ), // child: Padding( // padding: const EdgeInsets.all(90), // child: SafeArea( // child: SingleChildScrollView( // child: Column( // children: [ // SizedBox(height: 80), // MultiButtonPlay('All Eyes on Me',"/Users/mehdihm/StudioProjects/tupac/assets/2.mp3"), // SizedBox(height: 20), // MultiButtonPlay('Dear Mama', '/Users/mehdihm/StudioProjects/tupac/assets/3.mp3'), // SizedBox(height: 20), // MultiButtonPlay('GTA San Andreas', '/Users/mehdihm/StudioProjects/tupac/assets/1.mp3'), // SizedBox(height: 20), // MultiButtonPlay('Dont Sleep', '/Users/mehdihm/StudioProjects/tupac/assets/5.mp3'), // SizedBox(height: 20), // MultiButtonPlay('Dont Stop', '/Users/mehdihm/StudioProjects/tupac/assets/6.mp3'), // SizedBox(height: 20), // MultiButtonPlay('Fuck The World', '/Users/mehdihm/StudioProjects/tupac/assets/7.mp3'), // SizedBox(height: 20), // MultiButtonPlay('Jewels', '/Users/mehdihm/StudioProjects/tupac/assets/8.mp3'), // SizedBox(height: 20), // MultiButtonPlay('Keep Ya Head Up', '/Users/mehdihm/StudioProjects/tupac/assets/9.mp3'), // SizedBox(height: 20), // MultiButtonPlay('Lil Homies', '/Users/mehdihm/StudioProjects/tupac/assets/10.mp3'), // SizedBox(height: 20), // MultiButtonPlay('New York', '/Users/mehdihm/StudioProjects/tupac/assets/11.mp3'), // SizedBox(height: 20), // MultiButtonPlay('Smoke Wit Me', '/Users/mehdihm/StudioProjects/tupac/assets/12.mp3'), // SizedBox(height: 20), // MultiButtonPlay('The Money', '/Users/mehdihm/StudioProjects/tupac/assets/13.mp3'), // SizedBox(height: 20), // MultiButtonPlay('Thug Nature', '/Users/mehdihm/StudioProjects/tupac/assets/14.mp3'), // SizedBox(height: 20), // MultiButtonPlay('Thug Style', '/Users/mehdihm/StudioProjects/tupac/assets/15.mp3'), // // ], // ), // ), // ), // ),)) // ), // ), // )); // } // // // Widget MultiButtonPlay(song_name, path){ // final _player = AudioPlayer(); // return Material( // borderRadius: BorderRadius.all(Radius.circular(40)), // color: Color(0xff6F4B3D).withOpacity(.1), // elevation: 1, // child: Container( // margin: EdgeInsets.all(10), // height: 40, // width: 270, // child: // GestureDetector( // onTap: (){ // _player.setAudioSource(AudioSource.asset(path)); // _player.play(); // }, // onDoubleTap: (){ // _player.stop(); // }, // child: Center( // child: Row(mainAxisAlignment: MainAxisAlignment.center, // children: [ // Icon(Icons.music_note, size: 30, color: Colors.white54,), // SizedBox(width: 10), // Text(song_name, style: TextStyle( fontSize: 25, fontWeight: FontWeight.w200, color: Colors.white60, fontFamily: 'DancingScript'),) // ], // ), // ), // ), // ), // ); // } // // // // // // // // // SizedBox(height: 80), // multiButtonPlay('All Eyes on Me',"/Users/mehdihm/StudioProjects/tupac/assets/2.mp3"), // SizedBox(height: 20), // multiButtonPlay('Dear Mama', '/Users/mehdihm/StudioProjects/tupac/assets/3.mp3'), // SizedBox(height: 20), // multiButtonPlay('GTA San Andreas', '/Users/mehdihm/StudioProjects/tupac/assets/1.mp3'), // SizedBox(height: 20), // multiButtonPlay('Dont Sleep', '/Users/mehdihm/StudioProjects/tupac/assets/5.mp3'), // SizedBox(height: 20), // multiButtonPlay('Dont Stop', '/Users/mehdihm/StudioProjects/tupac/assets/6.mp3'), // SizedBox(height: 20), // multiButtonPlay('Fuck The World', '/Users/mehdihm/StudioProjects/tupac/assets/7.mp3'), // SizedBox(height: 20), // multiButtonPlay('Jewels', '/Users/mehdihm/StudioProjects/tupac/assets/8.mp3'), // SizedBox(height: 20), // multiButtonPlay('Keep Ya Head Up', '/Users/mehdihm/StudioProjects/tupac/assets/9.mp3'), // SizedBox(height: 20), // multiButtonPlay('Lil Homies', '/Users/mehdihm/StudioProjects/tupac/assets/10.mp3'), // SizedBox(height: 20), // multiButtonPlay('New York', '/Users/mehdihm/StudioProjects/tupac/assets/11.mp3'), // SizedBox(height: 20), // multiButtonPlay('Smoke Wit Me', '/Users/mehdihm/StudioProjects/tupac/assets/12.mp3'), // SizedBox(height: 20), // multiButtonPlay('The Money', '/Users/mehdihm/StudioProjects/tupac/assets/13.mp3'), // SizedBox(height: 20), // multiButtonPlay('Thug Nature', '/Users/mehdihm/StudioProjects/tupac/assets/14.mp3'), // SizedBox(height: 20), // multiButtonPlay('Thug Style', '/Users/mehdihm/StudioProjects/tupac/assets/15.mp3'), import 'package:flutter/material.dart'; import 'package:just_audio/just_audio.dart'; void main(){ runApp(MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( appBar: AppBar( centerTitle: true, title: Text( '2pac', style: TextStyle(fontWeight: FontWeight.w900, fontSize: 50, fontFamily: 'DancingScript'), ), backgroundColor: Color(0xff230C33), ), body: Container( decoration: BoxDecoration( image: DecorationImage( image: NetworkImage('https://w0.peakpx.com/wallpaper/64/34/HD-wallpaper-tupac-discover-more-2pac-hip-hop-rap-rapper-tupac-in-2022-tupac-hip-hop-poster-tupac-tupac-art.jpg'), fit: BoxFit.cover ) ), child: Container( child: Container( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.bottomCenter, colors: [Colors.black.withOpacity(.2), Colors.black.withOpacity(.1)], ) ), child: Padding( padding: const EdgeInsets.all(90.0), child: SafeArea( child: SingleChildScrollView( child: Column( // crossAxisAlignment: CrossAxisAlignment , children: [ SizedBox(height: 80), multiButtonPlay('All Eyes on Me',"/Users/mehdihm/StudioProjects/tupac/assets/2.mp3"), SizedBox(height: 20), multiButtonPlay('Dear Mama', '/Users/mehdihm/StudioProjects/tupac/assets/3.mp3'), SizedBox(height: 20), multiButtonPlay('GTA San Andreas', '/Users/mehdihm/StudioProjects/tupac/assets/1.mp3'), SizedBox(height: 20), multiButtonPlay('Dont Sleep', '/Users/mehdihm/StudioProjects/tupac/assets/5.mp3'), SizedBox(height: 20), multiButtonPlay('Dont Stop', '/Users/mehdihm/StudioProjects/tupac/assets/6.mp3'), SizedBox(height: 20), multiButtonPlay('Fuck The World', '/Users/mehdihm/StudioProjects/tupac/assets/7.mp3'), SizedBox(height: 20), multiButtonPlay('Jewels', '/Users/mehdihm/StudioProjects/tupac/assets/8.mp3'), SizedBox(height: 20), multiButtonPlay('Keep Ya Head Up', '/Users/mehdihm/StudioProjects/tupac/assets/9.mp3'), SizedBox(height: 20), multiButtonPlay('Lil Homies', '/Users/mehdihm/StudioProjects/tupac/assets/10.mp3'), SizedBox(height: 20), multiButtonPlay('New York', '/Users/mehdihm/StudioProjects/tupac/assets/11.mp3'), SizedBox(height: 20), multiButtonPlay('Smoke Wit Me', '/Users/mehdihm/StudioProjects/tupac/assets/12.mp3'), SizedBox(height: 20), multiButtonPlay('The Money', '/Users/mehdihm/StudioProjects/tupac/assets/13.mp3'), SizedBox(height: 20), multiButtonPlay('Thug Nature', '/Users/mehdihm/StudioProjects/tupac/assets/14.mp3'), SizedBox(height: 20), multiButtonPlay('Thug Style', '/Users/mehdihm/StudioProjects/tupac/assets/15.mp3'), // multiButtonPlay() ], ), ), ), ), ), ), ),))); } // // Widget playButton(song_name, path){ // return InkWell( // onTap: (){ // final _player = AudioPlayer(); // _player.setAudioSource(AudioSource.asset(path)) ; // _player.play(); // }, // child: Center( // child: Container( // margin: EdgeInsets.all(10), // height: 60, // width: 300, // decoration: BoxDecoration( // borderRadius: BorderRadius.circular(50), // color: Color(0xff6F4B3D) // // ), // child: Padding( // padding: const EdgeInsets.all(12.0), // child: Row( // mainAxisAlignment: MainAxisAlignment.center, // children: [ // Icon( Icons.music_note_rounded, size: 44, color: Colors.white60,), // Text(song_name, style: TextStyle(fontSize: 20, fontWeight: FontWeight.w900, color: Colors.white60),) // ], // ), // ), // ), // ), // ); // } Widget multiButtonPlay(song_name, path){ final _player = AudioPlayer(); return Material( borderRadius: BorderRadius.all(Radius.circular(40)), color: Color(0xff6F4B3D).withOpacity(.1), elevation: 1, child: Container( margin: EdgeInsets.all(10), height: 40, width: 270, child: GestureDetector( onTap: (){ _player.setAudioSource(AudioSource.asset(path)) ; _player.play() ; }, onDoubleTap: (){ _player.stop() ; }, child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.music_note, size: 30, color: Colors.white60,), SizedBox(width: 10), Text(song_name, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w200, color: Colors.white60, fontFamily: 'DancingScript'),), // Icon( Icons.pause_circle, size: 30, color: Colors.white60,), ], ), ), ), ) ); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter 2Pac Music Playlist (just_audio)
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter 2Pac Music Playlist (just_audio)/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:tupac/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Neumorphic Button with Lottie Animations
mirrored_repositories/MHM-Flutter-UI-UX-Tutorial/Flutter Neumorphic Button with Lottie Animations/lib/main.dart
import 'package:flutter/material.dart'; import 'package:lottie/lottie.dart'; void main(){ runApp(MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( backgroundColor: Colors.grey[300], body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ neu_lottie_button('https://assets3.lottiefiles.com/private_files/lf30_gc1mnufr.json', 40), SizedBox(height: 30,), neu_lottie_button('https://assets3.lottiefiles.com/private_files/lf30_gc1mnufr.json', 150), ], ), ), ), )); } Widget neu_lottie_button(path, double r){ return Container( height: 250, width: 250, child: Lottie.network(path), decoration: BoxDecoration( color: Colors.grey[300], borderRadius: BorderRadius.all(Radius.circular(r)), boxShadow: [ BoxShadow( color: (Colors.grey[500])!, offset: Offset(-4,-4), blurRadius: 15, spreadRadius: 1 ), BoxShadow( color: (Colors.white)!, offset: Offset(4,4), blurRadius: 15, spreadRadius: 1 ) ] ), ); }
0