You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
4.1 KiB

2 years ago
  1. // import 'package:blog_app/widgets/Text.dart';
  2. // ignore_for_file: prefer_const_constructors
  3. import 'package:itasmob/app/di.dart';
  4. import 'package:itasmob/presentation/home/home_vm.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:charts_flutter/flutter.dart' as charts;
  7. import '../../widgets/header_widgets.dart';
  8. import '../common/theme_helper.dart';
  9. class HomeView extends StatefulWidget {
  10. const HomeView({Key? key}): super(key:key);
  11. @override
  12. _HomePageState createState() => _HomePageState();
  13. }
  14. class PieData {
  15. PieData(this.activity, this.time);
  16. String activity;
  17. double time;
  18. }
  19. class _HomePageState extends State<HomeView>{
  20. double _headerHeight = 150;
  21. Key _formKey = GlobalKey<FormState>();
  22. int _selectedIndex = 0;
  23. late List<charts.Series<PieData, String>> _pieData;
  24. @override void initState() {
  25. super.initState();
  26. _pieData = <charts.Series<PieData, String>>[];
  27. }
  28. generateData() {
  29. var piedata = [
  30. new PieData('Work', 35.8),
  31. new PieData('Eat', 8.3),
  32. new PieData('Commute', 10.8),
  33. new PieData('TV', 15.6),
  34. new PieData('Sleep', 19.2),
  35. new PieData('Other', 10.3),
  36. ];
  37. _pieData.add(
  38. charts.Series(
  39. domainFn: (PieData data, _) => data.activity,
  40. measureFn: (PieData data, _) => data.time,
  41. id: 'Time spent',
  42. data: piedata,
  43. labelAccessorFn: (PieData row, _) => '${row.activity}',
  44. ),
  45. );
  46. return _pieData;
  47. }
  48. @override
  49. Widget build(BuildContext context) {
  50. return Scaffold(
  51. backgroundColor: Colors.white,
  52. body: SingleChildScrollView(
  53. child: Column(
  54. children: [
  55. Container(
  56. height: _headerHeight,
  57. child: HeaderWidget(_headerHeight, true, Icons.person),
  58. ),
  59. SafeArea(
  60. child: Container(
  61. padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
  62. margin: EdgeInsets.fromLTRB(20, 10, 20, 10),// This will be the login form
  63. child: Column(
  64. children: [
  65. Text(
  66. 'Homepage',
  67. style: TextStyle(fontSize: 40,color: Colors.indigoAccent , fontWeight: FontWeight.bold),
  68. ),
  69. Text(
  70. '',
  71. style: TextStyle(color: Colors.grey),
  72. ),
  73. SizedBox(height: 0.0),
  74. Form(
  75. key: _formKey,
  76. child: Column(
  77. children: [
  78. Container(
  79. child: TextField(
  80. decoration: ThemeHelper().textInputDecoration('search'),
  81. ),
  82. decoration: ThemeHelper().inputBoxDecorationShaddow(),
  83. ),
  84. SizedBox(height: 20.0),
  85. SizedBox(height: 15.0),
  86. ]
  87. ),
  88. ),
  89. ]
  90. ),
  91. ),
  92. ),
  93. ]
  94. ),
  95. ),
  96. bottomNavigationBar: BottomNavigationBar(
  97. items: const <BottomNavigationBarItem>[
  98. BottomNavigationBarItem(
  99. icon: Icon(Icons.home),
  100. label: 'Home',
  101. backgroundColor: Colors.white,
  102. ),
  103. BottomNavigationBarItem(
  104. icon: Icon(Icons.badge_rounded),
  105. label: 'Business',
  106. backgroundColor: Colors.white,
  107. ),
  108. BottomNavigationBarItem(
  109. icon: Icon(Icons.school),
  110. label: 'School',
  111. backgroundColor: Colors.white,
  112. ),
  113. BottomNavigationBarItem(
  114. icon: Icon(Icons.settings),
  115. label: 'Settings',
  116. backgroundColor: Colors.white,
  117. ),
  118. ],
  119. currentIndex: _selectedIndex,
  120. unselectedItemColor: Colors.black,
  121. selectedItemColor: Colors.blue,
  122. ),
  123. );
  124. }
  125. }