Initial commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
part 'language_event.dart';
|
||||
|
||||
part 'language_state.dart';
|
||||
|
||||
part 'language_bloc.freezed.dart';
|
||||
@injectable
|
||||
class LanguageBloc extends Bloc<LanguageEvent, LanguageState> {
|
||||
final StorageService _storageService;
|
||||
|
||||
LanguageBloc(this._storageService) : super(const LanguageState()) {
|
||||
on<_Started>(_onStarted);
|
||||
|
||||
on<_Changeded>(_onChanged);
|
||||
}
|
||||
|
||||
Future<void> _onStarted(_Started event, Emitter<LanguageState> emit) async {
|
||||
final lang = _storageService.getString(key: AppLocaleKeys.language);
|
||||
|
||||
if (lang != null) {
|
||||
emit(state.copyWith(currentLocale: Locale(lang)));
|
||||
} else {
|
||||
emit(state.copyWith(currentLocale: Locale("en")));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onChanged(_Changeded event, Emitter<LanguageState> emit) async {
|
||||
_storageService.setString(
|
||||
key: AppLocaleKeys.language,
|
||||
value: event.locale.languageCode,
|
||||
);
|
||||
emit(state.copyWith(currentLocale: event.locale));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,535 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, 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, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'language_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$LanguageEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LanguageEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $LanguageEventCopyWith<$Res> {
|
||||
$LanguageEventCopyWith(LanguageEvent _, $Res Function(LanguageEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [LanguageEvent].
|
||||
extension LanguageEventPatterns on LanguageEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _Changeded value)? changed,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Changeded() when changed != null:
|
||||
return changed(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _Changeded value) changed,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _Changeded():
|
||||
return changed(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _Changeded value)? changed,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Changeded() when changed != null:
|
||||
return changed(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function( Locale locale)? changed,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Changeded() when changed != null:
|
||||
return changed(_that.locale);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function( Locale locale) changed,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _Changeded():
|
||||
return changed(_that.locale);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function( Locale locale)? changed,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Changeded() when changed != null:
|
||||
return changed(_that.locale);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements LanguageEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Changeded implements LanguageEvent {
|
||||
const _Changeded(this.locale);
|
||||
|
||||
|
||||
final Locale locale;
|
||||
|
||||
/// Create a copy of LanguageEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ChangededCopyWith<_Changeded> get copyWith => __$ChangededCopyWithImpl<_Changeded>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Changeded&&(identical(other.locale, locale) || other.locale == locale));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,locale);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageEvent.changed(locale: $locale)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ChangededCopyWith<$Res> implements $LanguageEventCopyWith<$Res> {
|
||||
factory _$ChangededCopyWith(_Changeded value, $Res Function(_Changeded) _then) = __$ChangededCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
Locale locale
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ChangededCopyWithImpl<$Res>
|
||||
implements _$ChangededCopyWith<$Res> {
|
||||
__$ChangededCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Changeded _self;
|
||||
final $Res Function(_Changeded) _then;
|
||||
|
||||
/// Create a copy of LanguageEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? locale = null,}) {
|
||||
return _then(_Changeded(
|
||||
null == locale ? _self.locale : locale // ignore: cast_nullable_to_non_nullable
|
||||
as Locale,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LanguageState {
|
||||
|
||||
Locale get currentLocale;
|
||||
/// Create a copy of LanguageState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$LanguageStateCopyWith<LanguageState> get copyWith => _$LanguageStateCopyWithImpl<LanguageState>(this as LanguageState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LanguageState&&(identical(other.currentLocale, currentLocale) || other.currentLocale == currentLocale));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,currentLocale);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageState(currentLocale: $currentLocale)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $LanguageStateCopyWith<$Res> {
|
||||
factory $LanguageStateCopyWith(LanguageState value, $Res Function(LanguageState) _then) = _$LanguageStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
Locale currentLocale
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$LanguageStateCopyWithImpl<$Res>
|
||||
implements $LanguageStateCopyWith<$Res> {
|
||||
_$LanguageStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final LanguageState _self;
|
||||
final $Res Function(LanguageState) _then;
|
||||
|
||||
/// Create a copy of LanguageState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? currentLocale = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
currentLocale: null == currentLocale ? _self.currentLocale : currentLocale // ignore: cast_nullable_to_non_nullable
|
||||
as Locale,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [LanguageState].
|
||||
extension LanguageStatePatterns on LanguageState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LanguageState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LanguageState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LanguageState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( Locale currentLocale)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState() when $default != null:
|
||||
return $default(_that.currentLocale);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( Locale currentLocale) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState():
|
||||
return $default(_that.currentLocale);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( Locale currentLocale)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState() when $default != null:
|
||||
return $default(_that.currentLocale);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _LanguageState implements LanguageState {
|
||||
const _LanguageState({this.currentLocale = const Locale('en')});
|
||||
|
||||
|
||||
@override@JsonKey() final Locale currentLocale;
|
||||
|
||||
/// Create a copy of LanguageState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LanguageStateCopyWith<_LanguageState> get copyWith => __$LanguageStateCopyWithImpl<_LanguageState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LanguageState&&(identical(other.currentLocale, currentLocale) || other.currentLocale == currentLocale));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,currentLocale);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageState(currentLocale: $currentLocale)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LanguageStateCopyWith<$Res> implements $LanguageStateCopyWith<$Res> {
|
||||
factory _$LanguageStateCopyWith(_LanguageState value, $Res Function(_LanguageState) _then) = __$LanguageStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
Locale currentLocale
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LanguageStateCopyWithImpl<$Res>
|
||||
implements _$LanguageStateCopyWith<$Res> {
|
||||
__$LanguageStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _LanguageState _self;
|
||||
final $Res Function(_LanguageState) _then;
|
||||
|
||||
/// Create a copy of LanguageState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? currentLocale = null,}) {
|
||||
return _then(_LanguageState(
|
||||
currentLocale: null == currentLocale ? _self.currentLocale : currentLocale // ignore: cast_nullable_to_non_nullable
|
||||
as Locale,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,8 @@
|
||||
part of 'language_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LanguageEvent with _$LanguageEvent {
|
||||
const factory LanguageEvent.started() = _Started;
|
||||
|
||||
const factory LanguageEvent.changed(Locale locale) = _Changeded;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
part of 'language_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class LanguageState with _$LanguageState {
|
||||
const factory LanguageState({@Default(Locale('en')) Locale currentLocale}) =
|
||||
_LanguageState;
|
||||
}
|
||||
25
lib/feature/common/presentation/widgets/w_divider.dart
Normal file
25
lib/feature/common/presentation/widgets/w_divider.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WDivider extends StatelessWidget {
|
||||
const WDivider({
|
||||
super.key,
|
||||
this.height = 10,
|
||||
this.endIndent = 0,
|
||||
this.indent = 0,
|
||||
});
|
||||
|
||||
final double height;
|
||||
final double endIndent;
|
||||
final double indent;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Divider(
|
||||
color: AppColors.cF6F6F6,
|
||||
height: height,
|
||||
thickness: height,
|
||||
endIndent: 0,
|
||||
indent: 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
144
lib/feature/common/presentation/widgets/w_food_item.dart
Normal file
144
lib/feature/common/presentation/widgets/w_food_item.dart
Normal file
@@ -0,0 +1,144 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter_bounceable/flutter_bounceable.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WFoodItem extends StatelessWidget {
|
||||
const WFoodItem({
|
||||
super.key,
|
||||
this.imageHeight,
|
||||
this.textStyle1,
|
||||
this.textStyle2,
|
||||
this.enableTag = false,
|
||||
});
|
||||
|
||||
final double? imageHeight;
|
||||
final TextStyle? textStyle1;
|
||||
final TextStyle? textStyle2;
|
||||
final bool enableTag;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Bounceable(
|
||||
onTap: () {},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// CachedNetworkImage(
|
||||
// imageUrl: AppLocaleKeys.imageUrl,
|
||||
// width: 200,
|
||||
// height: 155,
|
||||
// fit: BoxFit.cover,
|
||||
// placeholder: (context, url) => CircularProgressIndicator(),
|
||||
// errorWidget: (context, url, error) => Icon(Icons.error),
|
||||
//
|
||||
// ),
|
||||
SizedBox(
|
||||
height: imageHeight ?? 155,
|
||||
width: context.w,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: AppLocaleKeys.imageUrl,
|
||||
width: 200,
|
||||
height: 155,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) =>
|
||||
Center(child: CircularProgressIndicator.adaptive()),
|
||||
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
right: 8,
|
||||
left: 0,
|
||||
child: Row(
|
||||
children: [
|
||||
if (enableTag)
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.c34A853,
|
||||
borderRadius: AppUtils.kBorderRadiusTop20Bottom20,
|
||||
),
|
||||
child: Text(
|
||||
"5 orders until \$8 reward",
|
||||
style: AppTextStyles.size14Medium.copyWith(
|
||||
color: AppColors.cFFFFFF,
|
||||
),
|
||||
).paddingOnly(top: 2, bottom: 2, left: 20, right: 40),
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: SvgPicture.asset(AppIcons.icDislike),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
8.verticalSpace,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Adenine Kitchen",
|
||||
style: textStyle1 ?? AppTextStyles.size16Medium,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 24,
|
||||
width: 24,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cEEEEEE,
|
||||
borderRadius: AppUtils.kBorderRadius28,
|
||||
),
|
||||
child: Center(
|
||||
child: Text("4.4", style: AppTextStyles.size12Regular),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// RichText(
|
||||
// text: TextSpan(
|
||||
// text: "\$0.29 Delivery Fee",
|
||||
// children: [TextSpan(text: "10-25 min")],
|
||||
// style: AppTextStyles.size14Regular.copyWith(
|
||||
// color: AppColors.c6B6B6B,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"\$0.29 Delivery Fee",
|
||||
style:
|
||||
textStyle2 ??
|
||||
AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
5.horizontalSpace,
|
||||
Icon(Icons.circle, size: 5, color: AppColors.c6B6B6B),
|
||||
5.horizontalSpace,
|
||||
Text(
|
||||
"10-25 min",
|
||||
style:
|
||||
textStyle2 ??
|
||||
AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15),
|
||||
);
|
||||
}
|
||||
}
|
||||
24
lib/feature/common/presentation/widgets/w_layout.dart
Normal file
24
lib/feature/common/presentation/widgets/w_layout.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WLayout extends StatelessWidget {
|
||||
const WLayout({
|
||||
super.key,
|
||||
this.bgColor = AppColors.cFFFFFF,
|
||||
this.bottom = true,
|
||||
this.top = true,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
final Color bgColor;
|
||||
final bool bottom;
|
||||
final bool top;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: bgColor,
|
||||
child: SafeArea(top: top, bottom: bottom, child: child),
|
||||
);
|
||||
}
|
||||
}
|
||||
21
lib/feature/common/presentation/widgets/w_see_all_raw.dart
Normal file
21
lib/feature/common/presentation/widgets/w_see_all_raw.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WSeeAllRaw extends StatelessWidget {
|
||||
const WSeeAllRaw({super.key, required this.title, required this.onPressed});
|
||||
|
||||
final String title;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(child: Text(title, style: AppTextStyles.size24Bold)),
|
||||
TextButton(
|
||||
onPressed: onPressed,
|
||||
child: Text("see all", style: AppTextStyles.size16Medium),
|
||||
),
|
||||
],
|
||||
).paddingOnly(left: 15, right: 8);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WStoriesListItem extends StatelessWidget {
|
||||
const WStoriesListItem({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 200,
|
||||
width: 155,
|
||||
child: ClipRRect(
|
||||
borderRadius: AppUtils.kBorderRadius10,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: AppLocaleKeys.imageUrl,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
|
||||
|
||||
],
|
||||
)
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
5
lib/feature/common/presentation/widgets/widgets.dart
Normal file
5
lib/feature/common/presentation/widgets/widgets.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
export 'w_layout.dart';
|
||||
export 'w_food_item.dart';
|
||||
export 'w_divider.dart';
|
||||
export 'w_see_all_raw.dart';
|
||||
export 'w_stories_list_item.dart';
|
||||
Reference in New Issue
Block a user