fooder-app/lib/screens/main.dart

44 lines
1.1 KiB
Dart
Raw Normal View History

2023-07-29 18:10:10 +02:00
import 'package:flutter/material.dart';
2023-07-29 18:47:13 +02:00
import 'package:fooder_web/screens/based.dart';
2023-07-29 19:21:02 +02:00
import 'package:fooder_web/models/meal.dart';
import 'package:fooder_web/models/entry.dart';
import 'package:fooder_web/models/diary.dart';
import 'package:fooder_web/widgets/diary.dart';
2023-07-29 18:10:10 +02:00
2023-07-29 20:01:56 +02:00
class MainScreen extends BasedScreen {
const MainScreen({super.key, required super.apiClient});
2023-07-29 18:10:10 +02:00
@override
2023-07-29 20:01:56 +02:00
State<MainScreen> createState() => _MainScreen();
2023-07-29 18:10:10 +02:00
}
2023-07-29 20:01:56 +02:00
class _MainScreen extends State<MainScreen> {
2023-07-29 20:10:59 +02:00
Diary? diary;
2023-07-29 18:10:10 +02:00
@override
Widget build(BuildContext context) {
2023-07-29 20:10:59 +02:00
var content;
if (diary != null) {
content = Container(
constraints: const BoxConstraints(maxWidth: 600),
padding: const EdgeInsets.all(10),
child: DiaryWidget(diary: diary!),
);
} else {
content = const CircularProgressIndicator();
}
2023-07-29 18:10:10 +02:00
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
2023-07-29 20:01:56 +02:00
title: Text("FOODER"),
2023-07-29 18:10:10 +02:00
),
body: Center(
2023-07-29 20:10:59 +02:00
child: content,
2023-07-29 18:10:10 +02:00
),
);
}
}