diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fb1c03a3..deeef79d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -58,7 +58,7 @@ jobs:
run: dart run test_cov
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: pinchbv/codecov-action-ga@main
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: floor_generator
@@ -76,7 +76,7 @@ jobs:
uses: actions/checkout@v2
- name: Install Flutter
- uses: subosito/flutter-action@v2
+ uses: pinchbv/flutter-action-ga@main
with:
channel: stable
architecture: x64
@@ -104,7 +104,7 @@ jobs:
working-directory: floor
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: pinchbv/codecov-action-ga@main
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: floor
@@ -119,7 +119,7 @@ jobs:
uses: actions/checkout@v2
- name: Install Flutter
- uses: subosito/flutter-action@v2
+ uses: pinchbv/flutter-action-ga@main
with:
channel: stable
diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml
new file mode 100644
index 00000000..a3be6b82
--- /dev/null
+++ b/example/analysis_options.yaml
@@ -0,0 +1 @@
+include: package:flutter_lints/flutter.yaml
\ No newline at end of file
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist
index 9367d483..9625e105 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 8.0
+ 11.0
diff --git a/example/ios/Podfile b/example/ios/Podfile
index d077b08b..d207307f 100644
--- a/example/ios/Podfile
+++ b/example/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
-# platform :ios, '9.0'
+# platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@@ -10,60 +10,29 @@ project 'Runner', {
'Release' => :release,
}
-def parse_KV_file(file, separator='=')
- file_abs_path = File.expand_path(file)
- if !File.exists? file_abs_path
- return [];
+def flutter_root
+ generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
+ unless File.exist?(generated_xcode_build_settings_path)
+ raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
- pods_ary = []
- skip_line_start_symbols = ["#", "/"]
- File.foreach(file_abs_path) { |line|
- next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
- plugin = line.split(pattern=separator)
- if plugin.length == 2
- podname = plugin[0].strip()
- path = plugin[1].strip()
- podpath = File.expand_path("#{path}", file_abs_path)
- pods_ary.push({:name => podname, :path => podpath});
- else
- puts "Invalid plugin specification: #{line}"
- end
- }
- return pods_ary
+
+ File.foreach(generated_xcode_build_settings_path) do |line|
+ matches = line.match(/FLUTTER_ROOT\=(.*)/)
+ return matches[1].strip if matches
+ end
+ raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
-target 'Runner' do
- # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
- # referring to absolute paths on developers' machines.
- system('rm -rf .symlinks')
- system('mkdir -p .symlinks/plugins')
+require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
- # Flutter Pods
- generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
- if generated_xcode_build_settings.empty?
- puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
- end
- generated_xcode_build_settings.map { |p|
- if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
- symlink = File.join('.symlinks', 'flutter')
- File.symlink(File.dirname(p[:path]), symlink)
- pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
- end
- }
+flutter_ios_podfile_setup
- # Plugin Pods
- plugin_pods = parse_KV_file('../.flutter-plugins')
- plugin_pods.map { |p|
- symlink = File.join('.symlinks', 'plugins', p[:name])
- File.symlink(p[:path], symlink)
- pod p[:name], :path => File.join(symlink, 'ios')
- }
+target 'Runner' do
+ flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
- target.build_configurations.each do |config|
- config.build_settings['ENABLE_BITCODE'] = 'NO'
- end
+ flutter_additional_ios_build_settings(target)
end
end
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
new file mode 100644
index 00000000..f88a1b1d
--- /dev/null
+++ b/example/ios/Podfile.lock
@@ -0,0 +1,31 @@
+PODS:
+ - Flutter (1.0.0)
+ - FMDB (2.7.5):
+ - FMDB/standard (= 2.7.5)
+ - FMDB/standard (2.7.5)
+ - sqflite (0.0.2):
+ - Flutter
+ - FMDB (>= 2.7.5)
+
+DEPENDENCIES:
+ - Flutter (from `Flutter`)
+ - sqflite (from `.symlinks/plugins/sqflite/ios`)
+
+SPEC REPOS:
+ trunk:
+ - FMDB
+
+EXTERNAL SOURCES:
+ Flutter:
+ :path: Flutter
+ sqflite:
+ :path: ".symlinks/plugins/sqflite/ios"
+
+SPEC CHECKSUMS:
+ Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
+ FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
+ sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
+
+PODFILE CHECKSUM: 663715e941f9adb426e33bf9376914006f9ea95b
+
+COCOAPODS: 1.12.1
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index d4fc6969..b201c7d2 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 46;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -150,7 +150,6 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
- E62E850C06B92A582AAB7B05 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -167,7 +166,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0910;
+ LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@@ -211,6 +210,7 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -243,6 +243,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -255,24 +256,6 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
- E62E850C06B92A582AAB7B05 /* [CP] Embed Pods Frameworks */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
- "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
- );
- name = "[CP] Embed Pods Frameworks";
- outputPaths = (
- "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
- showEnvVarsInLog = 0;
- };
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -347,7 +330,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -368,7 +351,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@@ -424,7 +410,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -471,7 +457,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -491,7 +477,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@@ -514,7 +503,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index 786d6aad..f1560181 100644
--- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,6 +1,6 @@
UIViewControllerBasedStatusBarAppearance
+ CADisableMinimumFrameDurationOnPhone
+
+ UIApplicationSupportsIndirectInputEvents
+
diff --git a/example/lib/database.g.dart b/example/lib/database.g.dart
index c593a4c1..f129903e 100644
--- a/example/lib/database.g.dart
+++ b/example/lib/database.g.dart
@@ -7,17 +7,16 @@ part of 'database.dart';
// **************************************************************************
// ignore: avoid_classes_with_only_static_members
+// ignore_for_file: library_private_types_in_public_api
class $FloorFlutterDatabase {
/// Creates a database builder for a persistent database.
/// Once a database is built, you should keep a reference to it and re-use it.
- static _$FlutterDatabaseBuilder databaseBuilder(String name) =>
- _$FlutterDatabaseBuilder(name);
+ static _$FlutterDatabaseBuilder databaseBuilder(String name) => _$FlutterDatabaseBuilder(name);
/// Creates a database builder for an in memory database.
/// Information stored in an in memory database disappears when the process is killed.
/// Once a database is built, you should keep a reference to it and re-use it.
- static _$FlutterDatabaseBuilder inMemoryDatabaseBuilder() =>
- _$FlutterDatabaseBuilder(null);
+ static _$FlutterDatabaseBuilder inMemoryDatabaseBuilder() => _$FlutterDatabaseBuilder(null);
}
class _$FlutterDatabaseBuilder {
@@ -43,9 +42,7 @@ class _$FlutterDatabaseBuilder {
/// Creates the database and initializes it.
Future build() async {
- final path = name != null
- ? await sqfliteDatabaseFactory.getDatabasePath(name!)
- : ':memory:';
+ final path = name != null ? await sqfliteDatabaseFactory.getDatabasePath(name!) : ':memory:';
final database = _$FlutterDatabase();
database.database = await database.open(
path,
@@ -78,8 +75,7 @@ class _$FlutterDatabase extends FlutterDatabase {
await callback?.onOpen?.call(database);
},
onUpgrade: (database, startVersion, endVersion) async {
- await MigrationAdapter.runMigrations(
- database, startVersion, endVersion, migrations);
+ await MigrationAdapter.runMigrations(database, startVersion, endVersion, migrations);
await callback?.onUpgrade?.call(database, startVersion, endVersion);
},
@@ -163,9 +159,7 @@ class _$TaskDao extends TaskDao {
row['isRead'] == null ? null : (row['isRead'] as int) != 0,
row['message'] as String,
_dateTimeConverter.decode(row['timestamp'] as int),
- row['status'] == null
- ? null
- : TaskStatus.values[row['status'] as int],
+ row['status'] == null ? null : TaskStatus.values[row['status'] as int],
_taskTypeConverter.decode(row['type'] as String?)),
arguments: [id]);
}
@@ -178,9 +172,7 @@ class _$TaskDao extends TaskDao {
row['isRead'] == null ? null : (row['isRead'] as int) != 0,
row['message'] as String,
_dateTimeConverter.decode(row['timestamp'] as int),
- row['status'] == null
- ? null
- : TaskStatus.values[row['status'] as int],
+ row['status'] == null ? null : TaskStatus.values[row['status'] as int],
_taskTypeConverter.decode(row['type'] as String?)));
}
@@ -192,9 +184,7 @@ class _$TaskDao extends TaskDao {
row['isRead'] == null ? null : (row['isRead'] as int) != 0,
row['message'] as String,
_dateTimeConverter.decode(row['timestamp'] as int),
- row['status'] == null
- ? null
- : TaskStatus.values[row['status'] as int],
+ row['status'] == null ? null : TaskStatus.values[row['status'] as int],
_taskTypeConverter.decode(row['type'] as String?)),
queryableName: 'task',
isView: false);
@@ -203,9 +193,7 @@ class _$TaskDao extends TaskDao {
@override
Stream findUniqueMessagesCountAsStream() {
return _queryAdapter.queryStream('SELECT DISTINCT COUNT(message) FROM task',
- mapper: (Map row) => row.values.first as int,
- queryableName: 'task',
- isView: false);
+ mapper: (Map row) => row.values.first as int, queryableName: 'task', isView: false);
}
@override
@@ -216,24 +204,34 @@ class _$TaskDao extends TaskDao {
row['isRead'] == null ? null : (row['isRead'] as int) != 0,
row['message'] as String,
_dateTimeConverter.decode(row['timestamp'] as int),
- row['status'] == null
- ? null
- : TaskStatus.values[row['status'] as int],
+ row['status'] == null ? null : TaskStatus.values[row['status'] as int],
_taskTypeConverter.decode(row['type'] as String?)),
arguments: [status.index],
queryableName: 'task',
isView: false);
}
+ @override
+ Stream> findAllTasksWithoutStatusAsStream() {
+ return _queryAdapter.queryListStream('SELECT * FROM task WHERE status IS NULL',
+ mapper: (Map row) => Task(
+ row['id'] as int?,
+ row['isRead'] == null ? null : (row['isRead'] as int) != 0,
+ row['message'] as String,
+ _dateTimeConverter.decode(row['timestamp'] as int),
+ row['status'] == null ? null : TaskStatus.values[row['status'] as int],
+ _taskTypeConverter.decode(row['type'] as String?)),
+ queryableName: 'task',
+ isView: false);
+ }
+
@override
Future updateTypeById(
TaskType type,
int id,
) async {
- return _queryAdapter.query(
- 'UPDATE OR ABORT Task SET type = ?1 WHERE id = ?2',
- mapper: (Map row) => row.values.first as int,
- arguments: [type.index, id]);
+ return _queryAdapter.query('UPDATE OR ABORT Task SET type = ?1 WHERE id = ?2',
+ mapper: (Map row) => row.values.first as int, arguments: [type.index, id]);
}
@override
diff --git a/example/lib/main.dart b/example/lib/main.dart
index bed0fcd0..db0c283f 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -6,9 +6,7 @@ import 'package:flutter/material.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
- final database = await $FloorFlutterDatabase
- .databaseBuilder('flutter_database.db')
- .build();
+ final database = await $FloorFlutterDatabase.databaseBuilder('flutter_database.db').build();
final dao = database.taskDao;
runApp(FloorApp(dao));
@@ -17,7 +15,7 @@ Future main() async {
class FloorApp extends StatelessWidget {
final TaskDao dao;
- const FloorApp(this.dao);
+ const FloorApp(this.dao, {super.key});
@override
Widget build(BuildContext context) {
@@ -47,7 +45,7 @@ class TasksWidget extends StatefulWidget {
}
class TasksWidgetState extends State {
- TaskStatus? _selectedType;
+ TaskStatusFilter _selectedFilter = TaskStatusFilter.all;
@override
Widget build(BuildContext context) {
@@ -65,13 +63,12 @@ class TasksWidgetState extends State {
PopupMenuButton(
itemBuilder: (context) {
return List.generate(
- TaskStatus.values.length +
- 1, //Uses increment to handle All types
+ TaskStatusFilter.values.length,
(index) {
return PopupMenuItem(
value: index,
child: Text(
- index == 0 ? 'All' : _getMenuType(index).title,
+ index == 0 ? 'All' : _getMenuType(index).label,
),
);
},
@@ -79,7 +76,7 @@ class TasksWidgetState extends State {
},
onSelected: (index) {
setState(() {
- _selectedType = index == 0 ? null : _getMenuType(index);
+ _selectedFilter = _getMenuType(index);
});
},
)
@@ -90,7 +87,7 @@ class TasksWidgetState extends State {
children: [
TasksListView(
dao: widget.dao,
- selectedType: _selectedType,
+ selectedStatus: _selectedFilter,
),
TasksTextField(dao: widget.dao),
],
@@ -99,27 +96,28 @@ class TasksWidgetState extends State {
);
}
- TaskStatus _getMenuType(int index) => TaskStatus.values[index - 1];
-
+ TaskStatusFilter _getMenuType(int index) => TaskStatusFilter.values[index];
}
class TasksListView extends StatelessWidget {
final TaskDao dao;
- final TaskStatus? selectedType;
+ final TaskStatusFilter selectedStatus;
const TasksListView({
Key? key,
required this.dao,
- required this.selectedType,
+ required this.selectedStatus,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: StreamBuilder>(
- stream: selectedType == null
+ stream: selectedStatus == TaskStatusFilter.all
? dao.findAllTasksAsStream()
- : dao.findAllTasksByStatusAsStream(selectedType!),
+ : selectedStatus == TaskStatusFilter.uncategorized
+ ? dao.findAllTasksWithoutStatusAsStream()
+ : dao.findAllTasksByStatusAsStream(_getTaskStatusFromFilter(selectedStatus)),
builder: (_, snapshot) {
if (!snapshot.hasData) return Container();
@@ -138,6 +136,19 @@ class TasksListView extends StatelessWidget {
),
);
}
+
+ TaskStatus _getTaskStatusFromFilter(TaskStatusFilter filter) {
+ switch (filter) {
+ case TaskStatusFilter.open:
+ return TaskStatus.open;
+ case TaskStatusFilter.inProgress:
+ return TaskStatus.inProgress;
+ case TaskStatusFilter.done:
+ return TaskStatus.done;
+ default:
+ return throw 'Invalid filter';
+ }
+ }
}
class TaskListCell extends StatelessWidget {
@@ -158,22 +169,22 @@ class TaskListCell extends StatelessWidget {
padding: const EdgeInsets.only(left: 16),
color: Colors.green,
child: const Align(
+ alignment: Alignment.centerLeft,
child: Text(
'Change status',
style: TextStyle(color: Colors.white),
),
- alignment: Alignment.centerLeft,
),
),
secondaryBackground: Container(
padding: const EdgeInsets.only(right: 16),
color: Colors.red,
child: const Align(
+ alignment: Alignment.centerRight,
child: Text(
'Delete',
style: TextStyle(color: Colors.white),
),
- alignment: Alignment.centerRight,
),
),
direction: DismissDirection.horizontal,
@@ -183,6 +194,7 @@ class TaskListCell extends StatelessWidget {
trailing: Text(task.timestamp.toIso8601String()),
),
confirmDismiss: (direction) async {
+ final scaffoldMessengerState = ScaffoldMessenger.of(context);
String? statusMessage;
switch (direction) {
case DismissDirection.endToStart:
@@ -191,10 +203,8 @@ class TaskListCell extends StatelessWidget {
break;
case DismissDirection.startToEnd:
final tasksLength = TaskStatus.values.length;
- final nextIndex =
- (tasksLength + task.statusIndex + 1) % tasksLength;
- final taskCopy =
- task.copyWith(status: TaskStatus.values[nextIndex]);
+ final nextIndex = task.statusIndex == null ? 0 : (tasksLength + task.statusIndex! + 1) % tasksLength;
+ final taskCopy = task.copyWith(status: TaskStatus.values[nextIndex]);
await dao.updateTask(taskCopy);
statusMessage = 'Updated task status by: ${taskCopy.statusTitle}';
break;
@@ -203,7 +213,6 @@ class TaskListCell extends StatelessWidget {
}
if (statusMessage != null) {
- final scaffoldMessengerState = ScaffoldMessenger.of(context);
scaffoldMessengerState.hideCurrentSnackBar();
scaffoldMessengerState.showSnackBar(
SnackBar(content: Text(statusMessage)),
@@ -265,9 +274,25 @@ class TasksTextField extends StatelessWidget {
if (message.trim().isEmpty) {
_textEditingController.clear();
} else {
- final task = Task.optional(message: message, type: TaskType.task);
+ final task = Task.optional(
+ message: message,
+ type: TaskType.task,
+ status: null,
+ );
await dao.insertTask(task);
_textEditingController.clear();
}
}
}
+
+enum TaskStatusFilter {
+ all('All'),
+ uncategorized('Uncategorized'),
+ open('Open'),
+ inProgress('In Progress'),
+ done('Done');
+
+ final String label;
+
+ const TaskStatusFilter(this.label);
+}
diff --git a/example/lib/task.dart b/example/lib/task.dart
index 3a7240e9..5887d66c 100644
--- a/example/lib/task.dart
+++ b/example/lib/task.dart
@@ -109,5 +109,5 @@ class Task {
extension TaskExtension on Task {
String get statusTitle => status?.title ?? 'Empty';
- int get statusIndex => status?.index ?? 0;
+ int? get statusIndex => status?.index;
}
diff --git a/example/lib/task_dao.dart b/example/lib/task_dao.dart
index cfdf8fe5..8e01233e 100644
--- a/example/lib/task_dao.dart
+++ b/example/lib/task_dao.dart
@@ -18,6 +18,9 @@ abstract class TaskDao {
@Query('SELECT * FROM task WHERE status = :status')
Stream> findAllTasksByStatusAsStream(TaskStatus status);
+ @Query('SELECT * FROM task WHERE status IS NULL')
+ Stream> findAllTasksWithoutStatusAsStream();
+
@Query('UPDATE OR ABORT Task SET type = :type WHERE id = :id')
Future updateTypeById(TaskType type, int id);
diff --git a/example/pubspec.lock b/example/pubspec.lock
index ad812b07..2950e134 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -235,6 +235,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_lints:
+ dependency: "direct dev"
+ description:
+ name: flutter_lints
+ sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -328,6 +336,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.1"
+ lints:
+ dependency: transitive
+ description:
+ name: lints
+ sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.1"
lists:
dependency: transitive
description:
@@ -454,7 +470,7 @@ packages:
source: hosted
version: "1.10.0"
sqflite:
- dependency: transitive
+ dependency: "direct main"
description:
name: sqflite
sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6
@@ -529,10 +545,10 @@ packages:
dependency: transitive
description:
name: strings
- sha256: "1f3db7347b8dfd9844ee7fb34883cffbe6cc723a63cb9f4a0aa19e619304b030"
+ sha256: b33f40c4dd3e597bf6d9e7f4f4dc282dad0f19b07d9f320cb5c2183859cbccf5
url: "https://pub.dev"
source: hosted
- version: "3.0.0"
+ version: "3.1.1"
synchronized:
dependency: transitive
description:
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 9ce5f914..93edf7f4 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -12,6 +12,7 @@ environment:
dependencies:
floor:
path: ../floor/
+ sqflite: ^2.2.8+4
flutter:
sdk: flutter
@@ -22,3 +23,4 @@ dev_dependencies:
path: ../floor_generator/
flutter_test:
sdk: flutter
+ flutter_lints: ^2.0.2
diff --git a/floor_generator/lib/writer/floor_writer.dart b/floor_generator/lib/writer/floor_writer.dart
index 697ae678..bf6ef591 100644
--- a/floor_generator/lib/writer/floor_writer.dart
+++ b/floor_generator/lib/writer/floor_writer.dart
@@ -39,6 +39,7 @@ class FloorWriter extends Writer {
return Class((builder) => builder
..name = '\$Floor$_databaseName'
..methods.addAll([databaseBuilderMethod, inMemoryDatabaseBuilderMethod])
+ ..docs.add('// ignore_for_file: library_private_types_in_public_api')
..docs.add('// ignore: avoid_classes_with_only_static_members'));
}
}
diff --git a/floor_generator/test/writer/floor_writer_test.dart b/floor_generator/test/writer/floor_writer_test.dart
index 39fd5d69..1a0b2c50 100644
--- a/floor_generator/test/writer/floor_writer_test.dart
+++ b/floor_generator/test/writer/floor_writer_test.dart
@@ -13,6 +13,7 @@ void main() {
final actual = FloorWriter(databaseName).write();
expect(actual, equalsDart(r'''
+ // ignore_for_file: library_private_types_in_public_api
// ignore: avoid_classes_with_only_static_members
class $FloorFooBar {
/// Creates a database builder for a persistent database.