50 lines
1.2 KiB
Dart
50 lines
1.2 KiB
Dart
import 'package:ltx_flutter/appwrite/database_api.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'today_views/day_view.dart';
|
|
import 'today_views/infinity_view.dart';
|
|
import 'today_views/week_view.dart';
|
|
|
|
class TodayPage extends StatefulWidget {
|
|
const TodayPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_TodayPageState createState() => _TodayPageState();
|
|
}
|
|
|
|
class _TodayPageState extends State<TodayPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return LayoutBuilder(
|
|
builder: (BuildContext context, BoxConstraints constraints) {
|
|
if (constraints.maxWidth > 800) {
|
|
return Text("Wide");
|
|
} else {
|
|
return Consumer<DatabaseAPI>(builder: (context, database, child) {
|
|
return database.ready
|
|
? NarrowView()
|
|
: Center(
|
|
child: CircularProgressIndicator(
|
|
value: database.progress,
|
|
));
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
class NarrowView extends StatelessWidget {
|
|
const NarrowView({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return DefaultTabController(
|
|
length: 4,
|
|
initialIndex: 0,
|
|
child: DayView()
|
|
);
|
|
}
|
|
}
|