diff --git a/assets/yoga_person.png b/assets/yoga_person.png deleted file mode 100644 index 8722f50..0000000 Binary files a/assets/yoga_person.png and /dev/null differ diff --git a/assets/yoga_women1.png b/assets/yoga_women1.png new file mode 100644 index 0000000..fd83fa9 Binary files /dev/null and b/assets/yoga_women1.png differ diff --git a/assets/yoga_women2.png b/assets/yoga_women2.png new file mode 100644 index 0000000..abea043 Binary files /dev/null and b/assets/yoga_women2.png differ diff --git a/assets/yoga_women3.png b/assets/yoga_women3.png new file mode 100644 index 0000000..34fbb9d Binary files /dev/null and b/assets/yoga_women3.png differ diff --git a/fonts/merriweather_bold.ttf b/fonts/merriweather_bold.ttf new file mode 100644 index 0000000..3e10e02 Binary files /dev/null and b/fonts/merriweather_bold.ttf differ diff --git a/fonts/merriweather_regular.ttf b/fonts/merriweather_regular.ttf new file mode 100644 index 0000000..3fecc77 Binary files /dev/null and b/fonts/merriweather_regular.ttf differ diff --git a/fonts/urbanist_bold.ttf b/fonts/urbanist_bold.ttf new file mode 100644 index 0000000..330e84f Binary files /dev/null and b/fonts/urbanist_bold.ttf differ diff --git a/fonts/urbanist_extrabold.ttf b/fonts/urbanist_extrabold.ttf new file mode 100644 index 0000000..7971b6d Binary files /dev/null and b/fonts/urbanist_extrabold.ttf differ diff --git a/fonts/urbanist_light.ttf b/fonts/urbanist_light.ttf new file mode 100644 index 0000000..5903400 Binary files /dev/null and b/fonts/urbanist_light.ttf differ diff --git a/fonts/urbanist_medium.ttf b/fonts/urbanist_medium.ttf new file mode 100644 index 0000000..e9a6dbb Binary files /dev/null and b/fonts/urbanist_medium.ttf differ diff --git a/fonts/urbanist_regular.ttf b/fonts/urbanist_regular.ttf new file mode 100644 index 0000000..2a794b2 Binary files /dev/null and b/fonts/urbanist_regular.ttf differ diff --git a/fonts/urbanist_semibold.ttf b/fonts/urbanist_semibold.ttf new file mode 100644 index 0000000..6d393d1 Binary files /dev/null and b/fonts/urbanist_semibold.ttf differ diff --git a/lib/data/data/habit/habit.dart b/lib/data/data/habit/habit.dart index 91aa131..0b35722 100644 --- a/lib/data/data/habit/habit.dart +++ b/lib/data/data/habit/habit.dart @@ -67,28 +67,30 @@ class HabitRecordData with _$HabitRecordData { @HiveType(typeId: 3) enum HabitCategory { @HiveField(0) - sports(Icons.sports_soccer, Colors.green), + sports(Icons.sports_basketball, Colors.orange), @HiveField(1) - health(Icons.local_hospital, Colors.red), + health(Icons.monitor_heart, Color(0xffADE25D)), @HiveField(2) work(Icons.work, Colors.blue), @HiveField(3) - study(Icons.book, Colors.purple), + study(Icons.book, Color(0xffFBBFCA)), @HiveField(4) - food(Icons.fastfood, Colors.orange), + food(Icons.restaurant, Colors.green), @HiveField(5) finance(Icons.monetization_on, Colors.yellow), @HiveField(6) - yoga(Icons.self_improvement, Colors.pink), + yoga(Icons.self_improvement, Color(0xffD664BE)), @HiveField(7) - social(Icons.people, Colors.teal), + social(Icons.people, Color(0xffF6BE9A)), @HiveField(8) - fun(Icons.emoji_emotions, Colors.deepPurple), + fun(Icons.headphones, Color(0xff7CC6FE)), @HiveField(9) - outdoors(Icons.nature_people, Colors.green), + outdoors(Icons.sports_tennis, Color(0xff8789C0)), @HiveField(10) reading(Icons.menu_book, Colors.blue), @HiveField(11) + fitness(Icons.fitness_center, Colors.indigoAccent), + @HiveField(12) others(Icons.grid_view_rounded, Colors.grey); final IconData icon; diff --git a/lib/data/data/habit/habit.g.dart b/lib/data/data/habit/habit.g.dart index bfc635c..7b8e4c0 100644 --- a/lib/data/data/habit/habit.g.dart +++ b/lib/data/data/habit/habit.g.dart @@ -36,6 +36,8 @@ class HabitCategoryAdapter extends TypeAdapter { case 10: return HabitCategory.reading; case 11: + return HabitCategory.fitness; + case 12: return HabitCategory.others; default: return HabitCategory.sports; @@ -78,9 +80,12 @@ class HabitCategoryAdapter extends TypeAdapter { case HabitCategory.reading: writer.writeByte(10); break; - case HabitCategory.others: + case HabitCategory.fitness: writer.writeByte(11); break; + case HabitCategory.others: + writer.writeByte(12); + break; } } @@ -205,6 +210,7 @@ Map _$$HabitDataImplToJson(_$HabitDataImpl instance) => const _$HabitCategoryEnumMap = { HabitCategory.sports: 'sports', + HabitCategory.fitness: 'fitness', HabitCategory.health: 'health', HabitCategory.work: 'work', HabitCategory.study: 'study', @@ -216,6 +222,7 @@ const _$HabitCategoryEnumMap = { HabitCategory.outdoors: 'outdoors', HabitCategory.reading: 'reading', HabitCategory.others: 'others', + }; _$HabitRecordDataImpl _$$HabitRecordDataImplFromJson( diff --git a/lib/main.dart b/lib/main.dart index 54c222a..069a9fc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -37,8 +37,7 @@ class MyApp extends StatelessWidget { // navigatorObservers: [], debugShowCheckedModeBanner: false, title: 'Rise', - theme: AppTheme.lightTheme(lightColorScheme), - darkTheme: AppTheme.darkTheme(darkColorScheme), + theme: AppTheme.darkTheme(darkColorScheme), home: const _AppBootstrapper(), ); }, diff --git a/lib/screens/settings/settings_screen.dart b/lib/screens/analytics/analytics_screen.dart similarity index 52% rename from lib/screens/settings/settings_screen.dart rename to lib/screens/analytics/analytics_screen.dart index 57289f3..b7261a6 100644 --- a/lib/screens/settings/settings_screen.dart +++ b/lib/screens/analytics/analytics_screen.dart @@ -1,12 +1,12 @@ import 'package:flutter/material.dart'; -class SettingsScreen extends StatelessWidget { - const SettingsScreen({super.key}); +class AnalyticsScreen extends StatelessWidget { + const AnalyticsScreen({super.key}); @override Widget build(BuildContext context) { return const Placeholder( - child: Text('Settings Screen'), + child: Text("Analytics Screen"), ); } } diff --git a/lib/screens/habits/add_habit_screen.dart b/lib/screens/habits/add_habit_screen.dart index 7806303..163c97f 100644 --- a/lib/screens/habits/add_habit_screen.dart +++ b/lib/screens/habits/add_habit_screen.dart @@ -6,6 +6,7 @@ import 'package:rise/theme.dart'; import '../../data/data/habit/habit.dart'; import '../onboarding/components/components.dart'; +import 'dart:math'; class AddHabitScreen extends StatefulWidget { const AddHabitScreen({super.key}); @@ -17,6 +18,16 @@ class AddHabitScreen extends StatefulWidget { class _AddHabitScreenState extends State { final _habitNameController = TextEditingController(); + String getRandomImg() { + const images = [ + // "assets/yoga_women1.png", + "assets/yoga_women2.png", + "assets/yoga_women3.png", + ]; + final random = Random(); + return images[random.nextInt(images.length)]; + } + @override Widget build(BuildContext context) { final height = context.height; @@ -27,14 +38,13 @@ class _AddHabitScreenState extends State { return Scaffold( resizeToAvoidBottomInset: false, appBar: AppBar( - // leading: IconButton( - // icon: const Icon(Icons.arrow_back_ios), - // onPressed: () { - // Navigator.pop(context); - // }, - // ), - title: const Text('Add Habit'), - ), + // leading: IconButton( + // icon: const Icon(Icons.arrow_back_ios), + // onPressed: () { + // Navigator.pop(context); + // }, + // ), + ), body: Padding( padding: EdgeInsets.symmetric(horizontal: width * 0.2), child: Column( @@ -44,10 +54,8 @@ class _AddHabitScreenState extends State { /// Title Text( 'Put a name for \nyour Habit', - style: textTheme.titleMedium?.copyWith( - fontSize: 20, - fontWeight: FontWeight.w500, - ), + style: textTheme.titleMedium + ?.copyWith(fontSize: 20, fontFamily: "Merriweather"), textAlign: TextAlign.start, ), const SizedBox(height: 16), @@ -59,7 +67,7 @@ class _AddHabitScreenState extends State { keyboardType: TextInputType.text, textCapitalization: TextCapitalization.sentences, decoration: InputDecoration( - hintText: 'eg: Go to Gym', + hintText: 'eg: Gym', hintStyle: TextStyle(color: colorScheme.outline), filled: true, fillColor: colorScheme.onInverseSurface, @@ -78,8 +86,8 @@ class _AddHabitScreenState extends State { /// Bottom Section: Illustration Image.asset( - 'assets/yoga_person.png', - height: 150, + getRandomImg(), + height: 200, ), SizedBox(height: height * 0.1), ], @@ -131,10 +139,8 @@ class SelectHabitCategory extends StatelessWidget { Text( 'Select a category for\nyour habit', textAlign: TextAlign.center, - style: context.textTheme.titleMedium?.copyWith( - fontSize: 20, - fontWeight: FontWeight.w500, - ), + style: context.textTheme.titleMedium + ?.copyWith(fontSize: 20, fontFamily: "Merriweather"), ), const SizedBox(height: 16), @@ -189,9 +195,9 @@ class HabitCategoryCard extends StatelessWidget { return GestureDetector( onTap: onTap, child: Container( - height: 88, - width: 88, - margin: const EdgeInsets.all(8), + height: 80, + width: 100, + margin: const EdgeInsets.only(left: 4, right: 4), decoration: BoxDecoration( color: cardColor.withAlpha(80), borderRadius: BorderRadius.circular(12), diff --git a/lib/screens/habits/components/habit_gridview_card.dart b/lib/screens/habits/components/habit_gridview_card.dart index 05c846c..50b6177 100644 --- a/lib/screens/habits/components/habit_gridview_card.dart +++ b/lib/screens/habits/components/habit_gridview_card.dart @@ -25,7 +25,7 @@ class HabitGridviewCard extends StatelessWidget { margin: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), padding: const EdgeInsets.symmetric(horizontal: 16), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), + borderRadius: BorderRadius.circular(16.0), border: Border.all( color: cardColor.withAlpha(80), ), diff --git a/lib/screens/habits/components/habit_listview_card.dart b/lib/screens/habits/components/habit_listview_card.dart index a85d2c4..f3ebc07 100644 --- a/lib/screens/habits/components/habit_listview_card.dart +++ b/lib/screens/habits/components/habit_listview_card.dart @@ -29,12 +29,15 @@ class HabitListViewCard extends StatelessWidget { decoration: BoxDecoration( gradient: LinearGradient( colors: [ - cardColor.withAlpha(80), - // cardColor.withOpacity(0.4), - cardColor.withAlpha(16), + cardColor.withAlpha(55), + cardColor.withAlpha(25), + cardColor.withAlpha(8), + cardColor.withAlpha(0), ], + begin: Alignment.topLeft, + end: Alignment.bottomRight, ), - borderRadius: BorderRadius.circular(8.0), + borderRadius: BorderRadius.circular(16.0), ), child: Column( children: [ @@ -49,7 +52,13 @@ class HabitListViewCard extends StatelessWidget { ), /// Habit Title - title: Text(data.name), + title: Text( + data.name, + style: context.textTheme.titleLarge?.copyWith( + fontFamily: "Merriweather", + fontSize: 20.0 + ), + ), /// Habit more options trailing: CircleAvatar( @@ -117,10 +126,13 @@ class DateTile extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ /// Day of the week - Text( - StringUtils.getWeekDay(date), - style: textTheme.labelSmall?.copyWith( - fontWeight: FontWeight.w300, + Opacity( + opacity: 0.7, + child: Text( + StringUtils.getWeekDay(date), + style: textTheme.labelSmall?.copyWith( + fontWeight: FontWeight.w300, + ), ), ), diff --git a/lib/screens/habits/habits_screen.dart b/lib/screens/habits/habits_screen.dart index 28e7466..99f30d8 100644 --- a/lib/screens/habits/habits_screen.dart +++ b/lib/screens/habits/habits_screen.dart @@ -1,61 +1,163 @@ import 'package:flutter/material.dart'; import 'package:rise/data/command/habit/habits_command.dart'; +import 'package:rise/theme.dart'; import 'add_habit_screen.dart'; import 'components/habit_gridview_card.dart'; import 'components/habit_listview_card.dart'; -class HabitsScreen extends StatelessWidget { +// class HabitsScreen extends StatelessWidget { +// const HabitsScreen({super.key}); +// +// @override +// Widget build(BuildContext context) { +// return DefaultTabController( +// length: 2, +// child: Scaffold( +// /// Tab Bar - Week View and Grid View +// appBar: AppBar( +// // toolbarHeight: 80, +// titleSpacing: 0, +// title: const TabBar( +// tabs: [ +// Tab( +// text: 'Week View', +// // icon: Icon(Icons.view_week), +// ), +// Tab( +// text: 'Grid View', +// // icon: Icon(Icons.grid_view), +// ), +// ], +// ), +// ), +// +// /// Habit List View +// body: const TabBarView( +// children: [ +// /// Week View +// HabitList(), +// +// /// Grid View +// HabitList(isGridView: true), +// ], +// ), +// +// /// Add New Habit Button +// floatingActionButton: FloatingActionButton( +// onPressed: () { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (context) { +// return const AddHabitScreen(); +// }, +// ), +// ); +// }, +// child: const Icon(Icons.add), +// ), +// ), +// ); +// } +// } + +class HabitsScreen extends StatefulWidget { const HabitsScreen({super.key}); @override - Widget build(BuildContext context) { - return DefaultTabController( - length: 2, - child: Scaffold( - /// Tab Bar - Week View and Grid View - appBar: AppBar( - // toolbarHeight: 80, - titleSpacing: 0, - title: const TabBar( - tabs: [ - Tab( - text: 'Week View', - // icon: Icon(Icons.view_week), - ), - Tab( - text: 'Grid View', - // icon: Icon(Icons.grid_view), - ), - ], - ), - ), + State createState() => _HabitsScreenState(); +} - /// Habit List View - body: const TabBarView( - children: [ - /// Week View - HabitList(), +class _HabitsScreenState extends State { + int _selectedIndex = 0; + late PageController _pageController; - /// Grid View - HabitList(isGridView: true), - ], - ), + @override + void initState() { + super.initState(); + _pageController = PageController(initialPage: _selectedIndex); + } - /// Add New Habit Button - floatingActionButton: FloatingActionButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return const AddHabitScreen(); - }, - ), - ); - }, - child: const Icon(Icons.add), + @override + void dispose() { + _pageController.dispose(); + super.dispose(); + } + + void _onPageChanged(int index) { + setState(() { + _selectedIndex = index; + }); + } + + void _onTogglePressed(int index) { + setState(() { + _selectedIndex = index; + _pageController.animateToPage( + index, + duration: const Duration(milliseconds: 100), + curve: Curves.easeInOut, + ); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text( + "Streak Habit", + style: context.textTheme.titleLarge?.copyWith( + color: Colors.orangeAccent, + fontWeight: FontWeight.w600, + ), ), + actions: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: ToggleButtons( + // color: Colors.grey, + // fillColor: Colors.grey, + // borderColor: Colors.grey, + // selectedColor: Colors.black, + // selectedBorderColor: Colors.grey, + isSelected: [_selectedIndex == 0, _selectedIndex == 1], + onPressed: _onTogglePressed, + constraints: const BoxConstraints(minHeight: 26, minWidth: 64), + borderRadius: BorderRadius.circular(8), + borderWidth: 0.5, + children: const [ + Icon(Icons.calendar_view_day), + Icon(Icons.calendar_view_month), + ], + ), + ), + ], + ), + body: PageView( + controller: _pageController, + onPageChanged: _onPageChanged, + children: const [ + /// Week View + HabitList(), + + /// Grid View + HabitList(isGridView: true), + ], + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return const AddHabitScreen(); + }, + ), + ); + }, + child: const Icon(Icons.add), ), ); } @@ -75,6 +177,35 @@ class HabitList extends StatelessWidget { return ValueListenableBuilder( valueListenable: HabitsCommand().habitDataListenable, builder: (context, box, child) { + if (box.length == 0) { + return GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return const AddHabitScreen(); + }, + ), + ); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/yoga_women2.png", + width: 240, + height: 240, + fit: BoxFit.cover, + ), + Text( + "+ Create a habit", + style: context.textTheme.headlineSmall, + ), + ], + ), + ); + } return ListView.builder( itemCount: box.length, itemBuilder: (context, index) { diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 5582c7f..634530b 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; +import 'package:rise/screens/analytics/analytics_screen.dart'; import 'package:rise/widgets/save_page_state.dart'; import 'habits/habits_screen.dart'; import 'pomodoro/pomodoro_screen.dart'; -import 'settings/settings_screen.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({super.key}); @@ -16,7 +16,7 @@ class _HomeScreenState extends State { static const pages = [ SavePageSate(child: HabitsScreen()), SavePageSate(child: PomodoroScreen()), - SavePageSate(child: SettingsScreen()), + SavePageSate(child: AnalyticsScreen()), ]; final _pageController = PageController(); @@ -76,8 +76,8 @@ class _BottomNavigationBarState extends State<_BottomNavigationBar> { items: const [ /// Habits BottomNavigationBarItem( - icon: Icon(Icons.home_outlined), - activeIcon: Icon(Icons.home), + icon: Icon(Icons.calendar_today), + activeIcon: Icon(Icons.calendar_month), label: 'Habits', ), @@ -85,14 +85,14 @@ class _BottomNavigationBarState extends State<_BottomNavigationBar> { BottomNavigationBarItem( icon: Icon(Icons.timer_outlined), activeIcon: Icon(Icons.timer), - label: 'Pomodoro', + label: 'Timer', ), /// Settings BottomNavigationBarItem( - icon: Icon(Icons.settings_outlined), - activeIcon: Icon(Icons.settings), - label: 'Settings', + icon: Icon(Icons.trending_up_outlined), + activeIcon: Icon(Icons.trending_up_sharp), + label: 'Analytics', ), ], ), diff --git a/lib/theme.dart b/lib/theme.dart index ad38bd8..f3258a5 100644 --- a/lib/theme.dart +++ b/lib/theme.dart @@ -6,25 +6,24 @@ import 'constants.dart'; class AppTheme { static Color get seedColor => kPurpleSeedColor; - static ThemeData lightTheme(ColorScheme? lightColorScheme) { - return _getFinalTheme( - ThemeData( - // fontFamily: 'DIN', - colorScheme: - lightColorScheme ?? ColorScheme.fromSeed(seedColor: seedColor), - ), - ); - } + // static ThemeData lightTheme(ColorScheme? lightColorScheme) { + // return _getFinalTheme( + // ThemeData( + // // fontFamily: 'DIN', + // colorScheme: + // lightColorScheme ?? ColorScheme.fromSeed(seedColor: seedColor), + // ), + // ); + // } static ThemeData darkTheme(ColorScheme? darkColorScheme) { return _getFinalTheme( ThemeData( - // fontFamily: 'DIN', - colorScheme: darkColorScheme ?? - ColorScheme.fromSeed( - seedColor: seedColor, - brightness: Brightness.dark, - ), + fontFamily: 'Urbanist', + colorScheme:ColorScheme.fromSeed( + seedColor: seedColor, + brightness: Brightness.dark, + ) ), ); } diff --git a/pubspec.yaml b/pubspec.yaml index d510ddc..e446000 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -100,7 +100,26 @@ flutter: # For details regarding adding assets from package dependencies, see # https://flutter.dev/to/asset-from-package - + fonts: + - family: Merriweather + fonts: + - asset: fonts/merriweather_bold.ttf + weight: 600 + - asset: fonts/merriweather_regular.ttf + weight: 400 + + - family: Urbanist + fonts: + - asset: fonts/urbanist_light.ttf + weight: 300 + - asset: fonts/urbanist_regular.ttf + weight: 400 + - asset: fonts/urbanist_medium.ttf + weight: 500 + - asset: fonts/urbanist_semibold.ttf + weight: 600 + - asset: fonts/urbanist_extrabold.ttf + weight: 700 # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a