49 lines
1.4 KiB
Dart
49 lines
1.4 KiB
Dart
|
import 'package:ernaehrung/android/components/chart/chart.dart';
|
||
|
import 'package:ernaehrung/android/components/chart/round_chart.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:hive/hive.dart';
|
||
|
|
||
|
import '../../android/components/form/form_builder.dart';
|
||
|
import '../../android/components/meals.dart';
|
||
|
import '../../android/models/user.dart';
|
||
|
import '../functions/responsive.dart';
|
||
|
|
||
|
class CommonWebComponent extends StatefulWidget {
|
||
|
const CommonWebComponent({Key? key}) : super(key: key);
|
||
|
|
||
|
@override
|
||
|
State<CommonWebComponent> createState() => _CommonWebComponentState();
|
||
|
}
|
||
|
|
||
|
class _CommonWebComponentState extends State<CommonWebComponent> {
|
||
|
Widget widgetResponsiveWidget(context) {
|
||
|
return (isDesktop(context) || isTablet(context))
|
||
|
? responsiveTabletAndWebComponent()
|
||
|
: responsiveMobileComponent();
|
||
|
}
|
||
|
|
||
|
Widget responsiveTabletAndWebComponent() {
|
||
|
return const Placeholder();
|
||
|
}
|
||
|
|
||
|
Widget responsiveMobileComponent() {
|
||
|
final box = Hive.box<User>("USER_BOX");
|
||
|
return box.isEmpty
|
||
|
? const FormBuilderComponent(lockTextFields: false)
|
||
|
: SingleChildScrollView(
|
||
|
child: Column(
|
||
|
children: [
|
||
|
const RoundChartComponent(),
|
||
|
const ChartComponent(),
|
||
|
MealsComponent()
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return widgetResponsiveWidget(context);
|
||
|
}
|
||
|
}
|