Skip to content

Commit

Permalink
Merge pull request #818 from dkaera/feature/web-support
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaera authored Mar 22, 2024
2 parents c8aead3 + 956625c commit 4146037
Show file tree
Hide file tree
Showing 15 changed files with 412 additions and 215 deletions.
27 changes: 19 additions & 8 deletions example/lib/database.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 12 additions & 14 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Future<void> main() async {
class FloorApp extends StatelessWidget {
final TaskDao dao;

const FloorApp(this.dao);
const FloorApp(this.dao, {super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -37,10 +37,10 @@ class TasksWidget extends StatefulWidget {
final TaskDao dao;

const TasksWidget({
Key? key,
super.key,
required this.title,
required this.dao,
}) : super(key: key);
});

@override
State<StatefulWidget> createState() => TasksWidgetState();
Expand Down Expand Up @@ -100,18 +100,17 @@ class TasksWidgetState extends State<TasksWidget> {
}

TaskStatus _getMenuType(int index) => TaskStatus.values[index - 1];

}

class TasksListView extends StatelessWidget {
final TaskDao dao;
final TaskStatus? selectedType;

const TasksListView({
Key? key,
super.key,
required this.dao,
required this.selectedType,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -145,10 +144,10 @@ class TaskListCell extends StatelessWidget {
final TaskDao dao;

const TaskListCell({
Key? key,
super.key,
required this.task,
required this.dao,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand All @@ -158,22 +157,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,
Expand Down Expand Up @@ -202,7 +201,7 @@ class TaskListCell extends StatelessWidget {
break;
}

if (statusMessage != null) {
if (statusMessage != null && context.mounted) {
final scaffoldMessengerState = ScaffoldMessenger.of(context);
scaffoldMessengerState.hideCurrentSnackBar();
scaffoldMessengerState.showSnackBar(
Expand All @@ -220,10 +219,9 @@ class TasksTextField extends StatelessWidget {
final TaskDao dao;

TasksTextField({
Key? key,
super.key,
required this.dao,
}) : _textEditingController = TextEditingController(),
super(key: key);
}) : _textEditingController = TextEditingController();

@override
Widget build(BuildContext context) {
Expand Down
Loading

0 comments on commit 4146037

Please sign in to comment.