Skip to content

Commit

Permalink
Merge pull request #235 from Uttkarsh-raj/main
Browse files Browse the repository at this point in the history
Added store to local storage feature to the fav list being saved.
  • Loading branch information
Debajyoti14 authored Jun 4, 2023
2 parents 1852573 + 09f96e6 commit e3d48c5
Show file tree
Hide file tree
Showing 33 changed files with 881 additions and 397 deletions.
12 changes: 12 additions & 0 deletions lib/data/hive_database.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:hive/hive.dart';

class HiveDatabase {
final _myDatabase = Hive.box("favorites_database");
void saveData(List<int> favs) {
_myDatabase.put("Favs", favs);
}

List<int> readData() {
return _myDatabase.get("Favs") ?? [];
}
}
7 changes: 6 additions & 1 deletion lib/data/widget_category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter_component_ui/ui_components/pricing_cards/pricing_cards.d
import 'package:flutter_component_ui/ui_components/segmented_controls/segmented_control_screen.dart';
import 'package:flutter_component_ui/ui_components/steppers/steppers.dart';

// import '../ui_components/progress_bars/progress_bars.dart';
import '../ui_components/radios/radios.dart';
import '../ui_components/sliders/sliders.dart';

Expand Down Expand Up @@ -63,10 +64,14 @@ final List<Map<String, dynamic>> widgetCategoryData = [
},
{
'categoryName': 'Radio',
'categoryScreen': RadioScreen(),
'categoryScreen': const RadioScreen(),
},
{
'categoryName': 'Stepper',
'categoryScreen': StepperScreen(),
},
// {
// 'categoryName': 'Progress Bars',
// 'categoryScreen': const ProgressBar(),
// },
];
5 changes: 4 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import 'package:flutter/material.dart';
import 'package:flutter_component_ui/provider/favorite_provider.dart';
import 'package:flutter_component_ui/screens/splash_screen.dart';
import 'package:flutter_component_ui/theme/theme.dart';
import 'package:hive_flutter/adapters.dart';
import 'package:provider/provider.dart';

import 'screens/main_page.dart';

void main() {
void main() async {
await Hive.initFlutter();
await Hive.openBox("favorites_database");
runApp(const MyApp());
}

Expand Down
Loading

0 comments on commit e3d48c5

Please sign in to comment.