refresh token

This commit is contained in:
efrilm
2025-09-20 18:05:15 +07:00
parent a58d1040af
commit 59a8d7f661
3 changed files with 43 additions and 75 deletions
+23 -71
View File
@@ -81,11 +81,11 @@ class _HomePageState extends State<HomePage> {
context.read<CurrentOutletBloc>().add(CurrentOutletEvent.currentOutlet());
}
void _refreshData() {
log('🔄 Refreshing local data...');
context.read<ProductLoaderBloc>().add(const ProductLoaderEvent.refresh());
context.read<CategoryLoaderBloc>().add(const CategoryLoaderEvent.refresh());
}
// void _refreshData() {
// log('🔄 Refreshing l ocal data...');
// context.read<ProductLoaderBloc>().add(const ProductLoaderEvent.refresh());
// context.read<CategoryLoaderBloc>().add(const CategoryLoaderEvent.refresh());
// }
void onCategoryTap(int index) {
searchController.clear();
@@ -130,9 +130,6 @@ class _HomePageState extends State<HomePage> {
backgroundColor: AppColors.white,
body: Column(
children: [
// Simple local mode indicator
_buildLocalIndicator(),
// Main content
Expanded(
child: Row(
@@ -171,44 +168,6 @@ class _HomePageState extends State<HomePage> {
);
}
// Simple local mode indicator without sync
Widget _buildLocalIndicator() {
return Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
color: Colors.blue.shade600,
child: Row(
children: [
Icon(Icons.storage, color: Colors.white, size: 16),
SizedBox(width: 8),
Expanded(
child: Text(
'Mode Lokal - Data tersimpan di perangkat',
style: TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.w500,
),
),
),
// Only refresh button
InkWell(
onTap: _refreshData,
child: Container(
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
borderRadius: BorderRadius.circular(4),
),
child: Icon(Icons.refresh, color: Colors.white, size: 14),
),
),
],
),
);
}
Widget _buildCategoryLoadingState() {
return Center(
child: Column(
@@ -303,32 +262,25 @@ class _HomePageState extends State<HomePage> {
// Simple home title
Widget _buildSimpleHomeTitle() {
return Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
border: Border(bottom: BorderSide(color: Colors.grey.shade200)),
),
child: HomeTitle(
controller: searchController,
onChanged: (value) {
setState(() {
searchQuery = value;
});
return HomeTitle(
controller: searchController,
onChanged: (value) {
setState(() {
searchQuery = value;
});
// Fast local search
Future.delayed(Duration(milliseconds: 200), () {
if (value == searchController.text) {
log('🔍 Local search: "$value"');
context.read<ProductLoaderBloc>().add(
ProductLoaderEvent.searchProduct(
query: value,
),
);
}
});
},
),
// Fast local search
Future.delayed(Duration(milliseconds: 200), () {
if (value == searchController.text) {
log('🔍 Local search: "$value"');
context.read<ProductLoaderBloc>().add(
ProductLoaderEvent.searchProduct(
query: value,
),
);
}
});
},
);
}