main_screen.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import 'package:fitness_dashboard_ui/util/responsive.dart';
  2. import 'package:fitness_dashboard_ui/widgets/dashboard_widget.dart';
  3. import 'package:fitness_dashboard_ui/widgets/side_menu_widget.dart';
  4. import 'package:fitness_dashboard_ui/widgets/summary_widget.dart';
  5. import 'package:flutter/material.dart';
  6. class MainScreen extends StatelessWidget {
  7. const MainScreen({super.key});
  8. @override
  9. Widget build(BuildContext context) {
  10. final isDesktop = Responsive.isDesktop(context);
  11. return Scaffold(
  12. drawer: !isDesktop
  13. ? const SizedBox(
  14. width: 250,
  15. child: SideMenuWidget(),
  16. )
  17. : null,
  18. endDrawer: Responsive.isMobile(context)
  19. ? SizedBox(
  20. width: MediaQuery.of(context).size.width * 0.8,
  21. child: const SummaryWidget(),
  22. )
  23. : null,
  24. body: SafeArea(
  25. child: Row(
  26. children: [
  27. if (isDesktop)
  28. Expanded(
  29. flex: 2,
  30. child: SizedBox(
  31. child: SideMenuWidget(),
  32. ),
  33. ),
  34. Expanded(
  35. flex: 7,
  36. child: DashboardWidget(),
  37. ),
  38. if (isDesktop)
  39. Expanded(
  40. flex: 3,
  41. child: SummaryWidget(),
  42. ),
  43. ],
  44. ),
  45. ),
  46. );
  47. }
  48. }