add promotion/detail

This commit is contained in:
Phuoc Nguyen
2025-10-24 14:42:14 +07:00
parent fbeaa3c9e8
commit 338d26a38a
12 changed files with 1681 additions and 122 deletions

View File

@@ -0,0 +1,30 @@
/// Provider: Current Page Index Provider
///
/// Manages the state of the current bottom navigation page index.
library;
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'current_page_provider.g.dart';
/// Current Page Index Notifier
///
/// Manages which page is currently displayed in the bottom navigation.
/// Pages:
/// - 0: Home
/// - 1: Loyalty
/// - 2: Promotions
/// - 3: Notifications
/// - 4: Account
@riverpod
class CurrentPageIndex extends _$CurrentPageIndex {
@override
int build() => 0;
/// Set the current page index
void setIndex(int index) {
if (index >= 0 && index <= 4) {
state = index;
}
}
}

View File

@@ -0,0 +1,100 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'current_page_provider.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
/// Current Page Index Notifier
///
/// Manages which page is currently displayed in the bottom navigation.
/// Pages:
/// - 0: Home
/// - 1: Loyalty
/// - 2: Promotions
/// - 3: Notifications
/// - 4: Account
@ProviderFor(CurrentPageIndex)
const currentPageIndexProvider = CurrentPageIndexProvider._();
/// Current Page Index Notifier
///
/// Manages which page is currently displayed in the bottom navigation.
/// Pages:
/// - 0: Home
/// - 1: Loyalty
/// - 2: Promotions
/// - 3: Notifications
/// - 4: Account
final class CurrentPageIndexProvider
extends $NotifierProvider<CurrentPageIndex, int> {
/// Current Page Index Notifier
///
/// Manages which page is currently displayed in the bottom navigation.
/// Pages:
/// - 0: Home
/// - 1: Loyalty
/// - 2: Promotions
/// - 3: Notifications
/// - 4: Account
const CurrentPageIndexProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'currentPageIndexProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$currentPageIndexHash();
@$internal
@override
CurrentPageIndex create() => CurrentPageIndex();
/// {@macro riverpod.override_with_value}
Override overrideWithValue(int value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<int>(value),
);
}
}
String _$currentPageIndexHash() => r'677ac5cabc001e152a7a79cc7fb7d3789ad49545';
/// Current Page Index Notifier
///
/// Manages which page is currently displayed in the bottom navigation.
/// Pages:
/// - 0: Home
/// - 1: Loyalty
/// - 2: Promotions
/// - 3: Notifications
/// - 4: Account
abstract class _$CurrentPageIndex extends $Notifier<int> {
int build();
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<int, int>,
int,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}