forked from Kind-Unes/HabitNow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finished the categories local nosql database
- Loading branch information
Showing
11 changed files
with
425 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:habit_now/src/utils/const.dart'; | ||
import 'package:habit_now/src/utils/models/task_model.dart'; | ||
import 'package:uuid/uuid.dart'; | ||
|
||
class NewCategoryState extends Equatable { | ||
final CategoryModel categoryModel; | ||
|
||
const NewCategoryState(this.categoryModel); | ||
|
||
@override | ||
List<Object?> get props => [categoryModel]; | ||
} | ||
|
||
class NewCategoryCubit extends Cubit<NewCategoryState> { | ||
NewCategoryCubit() | ||
: super(NewCategoryState(CategoryModel( | ||
color: AppColors.kLightPurple, | ||
icon: Icons.category, | ||
id: const Uuid().v4(), | ||
name: 'New category'))); | ||
|
||
void updateProperty( | ||
{String? name, | ||
String? id, | ||
IconData? icon, | ||
Color? color, | ||
bool? isPendingTask}) { | ||
final CategoryModel updatedTaskModel = CategoryModel( | ||
name: name ?? state.categoryModel.name, | ||
id: id ?? state.categoryModel.id, | ||
color: color ?? state.categoryModel.color, | ||
icon: icon ?? state.categoryModel.icon, | ||
); | ||
emit(NewCategoryState(updatedTaskModel)); | ||
} | ||
|
||
void initState() { | ||
emit(NewCategoryState(CategoryModel( | ||
color: AppColors.kLightPurple, | ||
icon: Icons.category, | ||
id: const Uuid().v4(), | ||
name: 'New category'))); | ||
} | ||
//! implement more if needed | ||
} | ||
|
||
// class EditTaskControllerCubit extends Cubit<void Function()> { | ||
// EditTaskControllerCubit() : super(() {}); | ||
// final TextEditingController controller = TextEditingController(); | ||
// final FocusNode focusNode = FocusNode(); | ||
|
||
// void initializeTextField(String text) { | ||
// // Set the initial text and highlight it | ||
// controller.text = text; | ||
// controller.selection = TextSelection( | ||
// baseOffset: 0, | ||
// extentOffset: controller.text.length, | ||
// ); | ||
|
||
// // Request focus to automatically highlight the text | ||
// focusNode.requestFocus(); | ||
// emit(() {}); | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.