feat:更新待办事项对话框功能
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppProvider with ChangeNotifier {
|
||||
class AppProvider with ChangeNotifier {
|
||||
int _currentIndex = 0;
|
||||
|
||||
int get currentIndex => _currentIndex;
|
||||
|
||||
void changeTab(int index) {
|
||||
_currentIndex = index;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
21
lib/provider/todo_provider.dart
Normal file
21
lib/provider/todo_provider.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flisp_app/models/todo.dart';
|
||||
|
||||
class TodoProvider with ChangeNotifier {
|
||||
TodoItem _formItem = TodoItem.getEmpty();
|
||||
|
||||
TodoItem get formItem => _formItem;
|
||||
|
||||
void resetForm() {
|
||||
_formItem = TodoItem.getEmpty();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void initForm(TodoItem todo) {
|
||||
_formItem.title = todo.title;
|
||||
_formItem.content = todo.content ?? '';
|
||||
_formItem.dueDate = todo.dueDate;
|
||||
_formItem.priority = todo.priority;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user