add promotion/detail
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user