mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 00:17:56 +00:00
initialized Dashboard Page
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:syncrow_app/features/dashboard/view/card_title.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/united_text.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/assets_manager.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
||||
|
||||
class CarbonEmission extends StatelessWidget {
|
||||
const CarbonEmission({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const CardTitle(
|
||||
title: "Carbon Emission",
|
||||
),
|
||||
const Gap(10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox.square(
|
||||
dimension: 30,
|
||||
child: SvgPicture.asset(
|
||||
IconsManager.CO2,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
const Gap(5),
|
||||
const Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BodySmall(
|
||||
text: StringsManager.emissions,
|
||||
),
|
||||
UnitedText(
|
||||
value: '120.00',
|
||||
valueSize: 14,
|
||||
unit: 'kg',
|
||||
unitSize: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const Gap(20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox.square(
|
||||
dimension: 30,
|
||||
child: SvgPicture.asset(
|
||||
IconsManager.sustainability,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
const Gap(5),
|
||||
const Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BodySmall(
|
||||
text: StringsManager.reductions,
|
||||
),
|
||||
UnitedText(
|
||||
value: '20.00',
|
||||
valueSize: 14,
|
||||
unit: 'kg',
|
||||
unitSize: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
|
||||
class CardTitle extends StatelessWidget {
|
||||
const CardTitle({
|
||||
super.key,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BodySmall(
|
||||
text: title,
|
||||
fontColor: Colors.grey,
|
||||
fontSize: 12,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:syncrow_app/features/dashboard/view/card_title.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/united_text.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/assets_manager.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
||||
|
||||
class Consumption extends StatelessWidget {
|
||||
const Consumption({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
const Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CardTitle(
|
||||
title: StringsManager.ACConsumption,
|
||||
),
|
||||
Gap(10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
UnitedText(
|
||||
value: "2",
|
||||
valueSize: 35,
|
||||
valueWeight: FontWeight.normal,
|
||||
unit: "Units",
|
||||
),
|
||||
Gap(30),
|
||||
UnitedText(
|
||||
value: "720",
|
||||
valueSize: 35,
|
||||
valueWeight: FontWeight.normal,
|
||||
unit: "kWh",
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
//TODO: Replace with actual pie chart
|
||||
SizedBox.square(
|
||||
dimension: 60,
|
||||
child: Image.asset(
|
||||
ImageManager.testDash2,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:syncrow_app/features/dashboard/view/carbon_emission.dart';
|
||||
import 'package:syncrow_app/features/dashboard/view/consumption.dart';
|
||||
import 'package:syncrow_app/features/dashboard/view/live_monitor_tab.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
||||
|
||||
import 'energy_usage.dart';
|
||||
|
||||
class DashboardView extends StatelessWidget {
|
||||
const DashboardView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder();
|
||||
return const Padding(
|
||||
padding: EdgeInsets.only(top: 60, right: 15, left: 15, bottom: 100),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
TitleMedium(
|
||||
text: StringsManager.dashboard,
|
||||
style: TextStyle(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
LiveMonitorTab(),
|
||||
Gap(10),
|
||||
EnergyUsage(),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Consumption(),
|
||||
Gap(20),
|
||||
CarbonEmission(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/dashboard/view/energy_usage_header.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/assets_manager.dart';
|
||||
|
||||
class EnergyUsage extends StatelessWidget {
|
||||
const EnergyUsage({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const EnergyUsageHeader(),
|
||||
Expanded(
|
||||
child: Image.asset(ImageManager.testDash),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/dashboard/view/card_title.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/united_text.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
||||
|
||||
class EnergyUsageHeader extends StatelessWidget {
|
||||
const EnergyUsageHeader({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CardTitle(
|
||||
title: StringsManager.energyUsage,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BodySmall(
|
||||
text: StringsManager.totalConsumption,
|
||||
),
|
||||
BodySmall(
|
||||
text: "JAN 2024",
|
||||
fontSize: 12,
|
||||
fontColor: Colors.grey,
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
UnitedText(
|
||||
value: "1200.00",
|
||||
valueStyle: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 0,
|
||||
),
|
||||
unit: "kWh",
|
||||
),
|
||||
UnitedText(
|
||||
value: "430",
|
||||
valueStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey,
|
||||
),
|
||||
unit: "AED",
|
||||
unitStyle: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/dashboard/view/live_monitor_widget.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/assets_manager.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
||||
|
||||
class LiveMonitorTab extends StatelessWidget {
|
||||
const LiveMonitorTab({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: LiveMonitorWidget(
|
||||
image: IconsManager.active,
|
||||
title: StringsManager.active,
|
||||
value: '10.00w',
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: LiveMonitorWidget(
|
||||
image: IconsManager.voltMeter,
|
||||
title: StringsManager.current,
|
||||
value: '12.1 A',
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: LiveMonitorWidget(
|
||||
image: IconsManager.frequency,
|
||||
title: StringsManager.frequency,
|
||||
value: '50 Hz',
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
|
||||
class LiveMonitorWidget extends StatelessWidget {
|
||||
const LiveMonitorWidget({
|
||||
super.key,
|
||||
required this.image,
|
||||
required this.title,
|
||||
required this.value,
|
||||
});
|
||||
|
||||
final String image;
|
||||
final String title;
|
||||
final String value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
padding: const EdgeInsets.only(left: 10, top: 5, bottom: 5),
|
||||
margin: const EdgeInsets.only(right: 5),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 23,
|
||||
width: 20,
|
||||
child: SvgPicture.asset(
|
||||
image,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
const Gap(5),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BodySmall(
|
||||
text: title,
|
||||
style: const TextStyle(fontSize: 10, color: Colors.grey)),
|
||||
BodyMedium(
|
||||
text: value,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../model/device_model.dart';
|
||||
|
||||
part 'devices_state.dart';
|
||||
|
||||
class DevicesCubit extends Cubit<DevicesState> {
|
||||
DevicesCubit() : super(DevicesInitial()) {
|
||||
getDevices();
|
||||
}
|
||||
|
||||
//TODO separate the navigation logic to another cubit
|
||||
static DevicesCubit get(context) => BlocProvider.of(context);
|
||||
|
||||
var devices = <DeviceModel>[];
|
||||
|
||||
Future<List<DeviceModel>> getDevices() async {
|
||||
emit(DevicesLoading());
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
emit(DevicesSuccess());
|
||||
|
||||
return devices = [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
part of 'devices_cubit.dart';
|
||||
|
||||
@immutable
|
||||
abstract class DevicesState {}
|
||||
|
||||
class DevicesInitial extends DevicesState {}
|
||||
|
||||
class DevicesLoading extends DevicesState {}
|
||||
|
||||
class DevicesSuccess extends DevicesState {}
|
||||
|
||||
class DevicesFailure extends DevicesState {}
|
||||
|
||||
class ChangeIndex extends DevicesState {}
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart';
|
||||
|
||||
class DevicesView extends StatelessWidget {
|
||||
const DevicesView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => DevicesCubit(),
|
||||
child: BlocBuilder<DevicesCubit, DevicesState>(
|
||||
builder: (context, state) => const DevicesViewBody(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../bloc/devices_cubit.dart';
|
||||
import 'no_devices_view.dart';
|
||||
|
||||
class DevicesViewBody extends StatelessWidget {
|
||||
const DevicesViewBody({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => DevicesCubit(),
|
||||
child: BlocBuilder<DevicesCubit, DevicesState>(
|
||||
builder: (context, state) {
|
||||
return DevicesCubit.get(context).devices.isEmpty
|
||||
? const NoDevicesView()
|
||||
: const SizedBox();
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,8 +3,8 @@ import 'package:gap/gap.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_text_button.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/assets_manager.dart';
|
||||
|
||||
class HomeViewNoDevices extends StatelessWidget {
|
||||
const HomeViewNoDevices({
|
||||
class NoDevicesView extends StatelessWidget {
|
||||
const NoDevicesView({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../profile/view/profile_view.dart';
|
||||
import '../../scene/view/scene_view.dart';
|
||||
import '../../smart/view/smart_view.dart';
|
||||
import '../model/device_model.dart';
|
||||
import '../view/widgets/home_view_body.dart';
|
||||
|
||||
part 'home_state.dart';
|
||||
|
||||
class HomeCubit extends Cubit<HomeState> {
|
||||
HomeCubit() : super(HomeInitial()) {
|
||||
getDevices();
|
||||
}
|
||||
|
||||
//TODO separate the navigation logic to another cubit
|
||||
static HomeCubit get(context) => BlocProvider.of(context);
|
||||
|
||||
static int pageIndex = 0;
|
||||
|
||||
var devices = <DeviceModel>[];
|
||||
|
||||
Future<List<DeviceModel>> getDevices() async {
|
||||
emit(HomeLoading());
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
emit(HomeSuccess());
|
||||
|
||||
return devices = [];
|
||||
}
|
||||
|
||||
Map<String, List<Widget>> appBarActions = {
|
||||
'Home': [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.mic),
|
||||
onPressed: () {},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add_circle),
|
||||
onPressed: () {},
|
||||
),
|
||||
],
|
||||
'Scene': [],
|
||||
'Smart': [],
|
||||
'Profile': [],
|
||||
};
|
||||
|
||||
var bottomNavItems = [
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home_outlined),
|
||||
label: 'Home',
|
||||
),
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.check_box_outlined),
|
||||
label: 'Scene',
|
||||
),
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.view_in_ar),
|
||||
label: 'Smart',
|
||||
),
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.account_circle),
|
||||
label: 'Profile',
|
||||
),
|
||||
];
|
||||
|
||||
final List<Widget> pages = [
|
||||
const HomeViewBody(),
|
||||
const SceneView(),
|
||||
const SmartPage(),
|
||||
const ProfileView(),
|
||||
];
|
||||
|
||||
static Widget get currentPage => HomeCubit().pages[pageIndex];
|
||||
|
||||
void updatePageIndex(int index, BuildContext context) {
|
||||
emit(HomeChangeIndex());
|
||||
pageIndex = index;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
part of 'home_cubit.dart';
|
||||
|
||||
@immutable
|
||||
abstract class HomeState {}
|
||||
|
||||
class HomeInitial extends HomeState {}
|
||||
|
||||
class HomeLoading extends HomeState {}
|
||||
|
||||
class HomeSuccess extends HomeState {}
|
||||
|
||||
class HomeFailure extends HomeState {}
|
||||
|
||||
class HomeChangeIndex extends HomeState {}
|
||||
@@ -1,28 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/home/bloc/home_cubit.dart';
|
||||
|
||||
import '../../shared_widgets/default_app_bar.dart';
|
||||
import '../../shared_widgets/default_nav_bar.dart';
|
||||
|
||||
class HomeView extends StatelessWidget {
|
||||
const HomeView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => HomeCubit(),
|
||||
child: BlocBuilder<HomeCubit, HomeState>(
|
||||
builder: (context, state) {
|
||||
return Scaffold(
|
||||
appBar: const DefaultAppBar(),
|
||||
body: state is HomeLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: HomeCubit.currentPage,
|
||||
bottomNavigationBar: const DefaultNavBar(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/home/bloc/home_cubit.dart';
|
||||
|
||||
import 'home_view_no_devices.dart';
|
||||
|
||||
class HomeViewBody extends StatelessWidget {
|
||||
const HomeViewBody({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => HomeCubit(),
|
||||
child: BlocBuilder<HomeCubit, HomeState>(
|
||||
builder: (context, state) {
|
||||
return HomeCubit.get(context).devices.isEmpty
|
||||
? const HomeViewNoDevices()
|
||||
: const SizedBox();
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
part 'layout_state.dart';
|
||||
|
||||
class LayoutCubit extends Cubit<LayoutState> {
|
||||
LayoutCubit() : super(LayoutInitial());
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
part of 'layout_cubit.dart';
|
||||
|
||||
@immutable
|
||||
abstract class LayoutState {}
|
||||
|
||||
class LayoutInitial extends LayoutState {}
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/layout/bloc/layout_cubit.dart';
|
||||
|
||||
class LayoutPage extends StatelessWidget {
|
||||
const LayoutPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => LayoutCubit(),
|
||||
child: BlocBuilder<LayoutCubit, LayoutState>(
|
||||
builder: (context, state) {
|
||||
return const Center(
|
||||
child: Text('Layout Page'),
|
||||
);
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
part 'menu_state.dart';
|
||||
|
||||
class MenuCubit extends Cubit<MenuState> {
|
||||
MenuCubit() : super(MenuInitial());
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
part of 'menu_cubit.dart';
|
||||
|
||||
@immutable
|
||||
abstract class MenuState {}
|
||||
|
||||
class MenuInitial extends MenuState {}
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MenuView extends StatelessWidget {
|
||||
const MenuView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Center(
|
||||
child: Text('Menu View'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart';
|
||||
import 'package:syncrow_app/features/layout/view/layout_view.dart';
|
||||
import 'package:syncrow_app/features/profile/view/profile_view.dart';
|
||||
import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/assets_manager.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
part 'nav_state.dart';
|
||||
|
||||
class NavCubit extends Cubit<NavState> {
|
||||
NavCubit() : super(NavInitial());
|
||||
|
||||
static NavCubit of(context) => BlocProvider.of<NavCubit>(context);
|
||||
static int pageIndex = 0;
|
||||
|
||||
int get getPageIndex => pageIndex;
|
||||
|
||||
Map<String, List<Widget>> appBarActions = {
|
||||
'Home': [],
|
||||
'Scene': [],
|
||||
'Smart': [],
|
||||
'Profile': [],
|
||||
};
|
||||
|
||||
var bottomNavItems = [
|
||||
defaultBottomNavBarItem(icon: IconsManager.dashboard, label: 'Dashboard'),
|
||||
defaultBottomNavBarItem(icon: IconsManager.layout, label: 'Layout'),
|
||||
defaultBottomNavBarItem(icon: IconsManager.devices, label: 'Devices'),
|
||||
defaultBottomNavBarItem(icon: IconsManager.routine, label: 'Routine'),
|
||||
defaultBottomNavBarItem(icon: IconsManager.menu, label: 'Menu'),
|
||||
];
|
||||
|
||||
final List<Widget> pages = [
|
||||
const DashboardView(),
|
||||
const LayoutPage(),
|
||||
const DevicesViewBody(),
|
||||
const SceneView(),
|
||||
const ProfileView(),
|
||||
];
|
||||
|
||||
Widget get currentPage => NavCubit().pages[pageIndex];
|
||||
|
||||
void updatePageIndex(int index, BuildContext context) {
|
||||
emit(NavChangePage());
|
||||
pageIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
BottomNavigationBarItem defaultBottomNavBarItem(
|
||||
{required String icon, required String label}) {
|
||||
return BottomNavigationBarItem(
|
||||
icon: SvgPicture.asset(icon),
|
||||
activeIcon: SvgPicture.asset(
|
||||
icon.replaceAll('.svg', '-fill.svg'),
|
||||
colorFilter: const ColorFilter.mode(
|
||||
ColorsManager.primaryColor,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
label: label,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
part of 'nav_cubit.dart';
|
||||
|
||||
abstract class NavState {}
|
||||
|
||||
class NavInitial extends NavState {}
|
||||
|
||||
class NavChangePage extends NavState {}
|
||||
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/navigation/bloc/nav_cubit.dart';
|
||||
import 'package:syncrow_app/features/navigation/view/widgets/app_body.dart';
|
||||
import 'package:syncrow_app/features/navigation/view/widgets/default_app_bar.dart';
|
||||
import 'package:syncrow_app/features/navigation/view/widgets/default_nav_bar.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class NavigationView extends StatelessWidget {
|
||||
const NavigationView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<NavCubit, NavState>(
|
||||
builder: (context, state) {
|
||||
return AnnotatedRegion(
|
||||
value: SystemUiOverlayStyle(
|
||||
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
||||
statusBarIconBrightness: Brightness.light,
|
||||
),
|
||||
child: const SafeArea(
|
||||
child: Scaffold(
|
||||
backgroundColor: ColorsManager.backgroundColor,
|
||||
extendBodyBehindAppBar: true,
|
||||
extendBody: true,
|
||||
appBar: DefaultAppBar(),
|
||||
body: AppBody(),
|
||||
bottomNavigationBar: DefaultNavBar(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/assets_manager.dart';
|
||||
|
||||
import '../../../shared_widgets/text_widgets/body_large.dart';
|
||||
|
||||
class AppBarHomeDropdown extends StatelessWidget {
|
||||
const AppBarHomeDropdown({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
onPressed: () {},
|
||||
child: SizedBox(
|
||||
width: 150,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SvgPicture.asset(
|
||||
IconsManager.home,
|
||||
width: 30,
|
||||
height: 30,
|
||||
),
|
||||
const Gap(5),
|
||||
const BodyLarge(text: 'Home'),
|
||||
const Gap(5),
|
||||
const Icon(
|
||||
Icons.expand_more,
|
||||
color: Colors.black,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/navigation/bloc/nav_cubit.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/assets_manager.dart';
|
||||
|
||||
class AppBody extends StatelessWidget {
|
||||
const AppBody({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<NavCubit, NavState>(
|
||||
builder: (context, state) {
|
||||
return Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
ImageManager.background,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
opacity: 0.4,
|
||||
),
|
||||
),
|
||||
child: NavCubit.of(context).currentPage,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/navigation/bloc/nav_cubit.dart';
|
||||
import 'package:syncrow_app/features/navigation/view/widgets/app_bar_home_dropdown.dart';
|
||||
|
||||
class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const DefaultAppBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<NavCubit, NavState>(
|
||||
builder: (context, state) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 20,
|
||||
),
|
||||
child: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
leadingWidth: 150,
|
||||
leading: const AppBarHomeDropdown(),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons.add,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(100);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/navigation/bloc/nav_cubit.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class DefaultNavBar extends StatelessWidget {
|
||||
const DefaultNavBar({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<NavCubit, NavState>(
|
||||
builder: (context, state) {
|
||||
var cubit = NavCubit.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 27),
|
||||
child: BottomNavigationBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
onTap: (int index) => cubit.updatePageIndex(index, context),
|
||||
currentIndex: cubit.getPageIndex,
|
||||
selectedItemColor: ColorsManager.primaryColor,
|
||||
selectedLabelStyle: const TextStyle(
|
||||
color: ColorsManager.primaryColor,
|
||||
fontSize: 10,
|
||||
),
|
||||
showUnselectedLabels: true,
|
||||
unselectedItemColor: Colors.grey,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
elevation: 0,
|
||||
items: cubit.bottomNavItems,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DefaultBottomNavBarItem extends BottomNavigationBarItem {
|
||||
DefaultBottomNavBarItem({required super.icon});
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/home/bloc/home_cubit.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/syncrow_logo.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const DefaultAppBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<HomeCubit, HomeState>(
|
||||
builder: (context, state) {
|
||||
return AppBar(
|
||||
title: const SyncrowLogo(),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(Icons.mic),
|
||||
onPressed: () {},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add_circle,
|
||||
color: ColorsManager.primaryColor),
|
||||
onPressed: () {},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(50);
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/home/bloc/home_cubit.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class DefaultNavBar extends StatelessWidget {
|
||||
const DefaultNavBar({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<HomeCubit, HomeState>(
|
||||
builder: (context, state) {
|
||||
return BottomNavigationBar(
|
||||
onTap: (int index) =>
|
||||
HomeCubit.get(context).updatePageIndex(index, context),
|
||||
currentIndex: HomeCubit.pageIndex,
|
||||
selectedItemColor: ColorsManager.primaryColor,
|
||||
selectedLabelStyle: const TextStyle(
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
unselectedItemColor: Colors.grey,
|
||||
elevation: 10,
|
||||
items: HomeCubit.get(context).bottomNavItems,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DefaultBottomNavBarItem extends BottomNavigationBarItem {
|
||||
DefaultBottomNavBarItem({required super.icon});
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
import 'custom_text_widget.dart';
|
||||
|
||||
class BodyLarge extends StatelessWidget {
|
||||
const BodyLarge({
|
||||
required this.text,
|
||||
super.key,
|
||||
this.textAlign,
|
||||
this.style,
|
||||
this.height,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final TextAlign? textAlign;
|
||||
|
||||
final TextStyle? style;
|
||||
|
||||
final double? height;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => CustomText(
|
||||
text,
|
||||
style: style ?? context.bodyLarge.copyWith(height: height ?? 1.5),
|
||||
textAlign: textAlign,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/custom_text_widget.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
class BodyMedium extends StatelessWidget {
|
||||
const BodyMedium({
|
||||
required this.text,
|
||||
super.key,
|
||||
this.style,
|
||||
this.maxLines,
|
||||
this.overflow,
|
||||
this.textAlign,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final TextStyle? style;
|
||||
final int? maxLines;
|
||||
final TextOverflow? overflow;
|
||||
|
||||
final TextAlign? textAlign;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => CustomText(
|
||||
text,
|
||||
style: style ?? context.bodyMedium,
|
||||
// softWrap: true,
|
||||
maxLines: maxLines,
|
||||
// overflow: overflow,
|
||||
textAlign: textAlign,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/custom_text_widget.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
class BodySmall extends StatelessWidget {
|
||||
const BodySmall({
|
||||
required this.text,
|
||||
super.key,
|
||||
this.style,
|
||||
this.fontColor,
|
||||
this.fontSize,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final TextStyle? style;
|
||||
|
||||
final Color? fontColor;
|
||||
|
||||
final double? fontSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => CustomText(
|
||||
text,
|
||||
style: style ?? context.bodySmall,
|
||||
fontColor: fontColor,
|
||||
fontSize: fontSize,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class CustomText extends StatelessWidget {
|
||||
const CustomText(this.text,
|
||||
{super.key,
|
||||
this.style,
|
||||
this.textAlign,
|
||||
this.onTap,
|
||||
this.minLines,
|
||||
this.maxLines,
|
||||
this.textDirection,
|
||||
this.fontSize,
|
||||
this.fontColor});
|
||||
|
||||
final String text;
|
||||
final TextStyle? style;
|
||||
final TextAlign? textAlign;
|
||||
final Function()? onTap;
|
||||
final int? minLines;
|
||||
final int? maxLines;
|
||||
final TextDirection? textDirection;
|
||||
|
||||
final double? fontSize;
|
||||
final Color? fontColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SelectableText(
|
||||
text,
|
||||
style: style!.copyWith(
|
||||
fontSize: fontSize,
|
||||
color: fontColor ?? ColorsManager.textPrimaryColor,
|
||||
),
|
||||
textAlign: textAlign,
|
||||
onTap: onTap,
|
||||
minLines: minLines,
|
||||
maxLines: maxLines,
|
||||
textDirection: textDirection,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/custom_text_widget.dart';
|
||||
|
||||
class DisplayLarge extends StatelessWidget {
|
||||
const DisplayLarge({
|
||||
required this.text,
|
||||
super.key,
|
||||
this.style,
|
||||
this.textAlign,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final TextStyle? style;
|
||||
|
||||
final TextAlign? textAlign;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => CustomText(
|
||||
text,
|
||||
style: style ?? Theme.of(context).textTheme.displayLarge,
|
||||
textAlign: textAlign,
|
||||
// softWrap: true,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'custom_text_widget.dart';
|
||||
|
||||
class DisplayMedium extends StatelessWidget {
|
||||
const DisplayMedium({
|
||||
required this.text,
|
||||
super.key,
|
||||
this.style,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final TextStyle? style;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => CustomText(
|
||||
text,
|
||||
style: style ?? Theme.of(context).textTheme.displayMedium,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
import 'custom_text_widget.dart';
|
||||
|
||||
class DisplaySmall extends StatelessWidget {
|
||||
const DisplaySmall({
|
||||
required this.text,
|
||||
super.key,
|
||||
this.textAlign,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final TextAlign? textAlign;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: CustomText(
|
||||
text,
|
||||
style: context.displaySmall,
|
||||
textAlign: textAlign,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
class TitleLarge extends StatelessWidget {
|
||||
const TitleLarge({
|
||||
required this.text,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String text;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 10),
|
||||
child: SelectableText(
|
||||
text,
|
||||
style: context.titleLarge,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
import 'custom_text_widget.dart';
|
||||
|
||||
class TitleMedium extends StatelessWidget {
|
||||
const TitleMedium({
|
||||
required this.text,
|
||||
super.key,
|
||||
this.maxLines,
|
||||
this.textAlign,
|
||||
this.style,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final int? maxLines;
|
||||
final TextAlign? textAlign;
|
||||
|
||||
final TextStyle? style;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => CustomText(
|
||||
text,
|
||||
style: style ?? context.titleMedium,
|
||||
maxLines: maxLines,
|
||||
textAlign: textAlign,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
import 'custom_text_widget.dart';
|
||||
|
||||
class TitleSmall extends StatelessWidget {
|
||||
const TitleSmall({
|
||||
required this.text,
|
||||
super.key,
|
||||
this.style,
|
||||
this.textAlign,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final TextStyle? style;
|
||||
final TextAlign? textAlign;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => CustomText(
|
||||
text,
|
||||
style: style ?? context.titleSmall,
|
||||
textAlign: textAlign,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
|
||||
class UnitedText extends StatelessWidget {
|
||||
const UnitedText({
|
||||
super.key,
|
||||
required this.value,
|
||||
required this.unit,
|
||||
this.valueStyle,
|
||||
this.unitStyle,
|
||||
this.valueSize,
|
||||
this.valueWeight,
|
||||
this.valueColor,
|
||||
this.unitSize,
|
||||
this.unitWeight,
|
||||
this.unitColor,
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
final TextStyle? valueStyle;
|
||||
final double? valueSize;
|
||||
final FontWeight? valueWeight;
|
||||
|
||||
final Color? valueColor;
|
||||
final String unit;
|
||||
|
||||
final TextStyle? unitStyle;
|
||||
final double? unitSize;
|
||||
final FontWeight? unitWeight;
|
||||
final Color? unitColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||
textBaseline: TextBaseline.alphabetic,
|
||||
children: [
|
||||
BodyLarge(
|
||||
text: value,
|
||||
style: valueStyle ??
|
||||
TextStyle(
|
||||
fontSize: valueSize ?? 20,
|
||||
fontWeight: valueWeight ?? FontWeight.bold,
|
||||
color: valueColor,
|
||||
height: 0,
|
||||
),
|
||||
),
|
||||
BodySmall(
|
||||
text: unit,
|
||||
style: unitStyle ??
|
||||
TextStyle(
|
||||
fontSize: unitSize ?? 10,
|
||||
fontWeight: unitWeight,
|
||||
color: unitColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
part 'smart_state.dart';
|
||||
|
||||
class SmartCubit extends Cubit<SmartState> {
|
||||
SmartCubit() : super(SmartInitial());
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
part of 'smart_cubit.dart';
|
||||
|
||||
@immutable
|
||||
abstract class SmartState {}
|
||||
|
||||
class SmartInitial extends SmartState {}
|
||||
@@ -1,20 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/smart/bloc/smart_cubit.dart';
|
||||
|
||||
class SmartPage extends StatelessWidget {
|
||||
const SmartPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => SmartCubit(),
|
||||
child: BlocBuilder<SmartCubit, SmartState>(
|
||||
builder: (context, state) {
|
||||
return const Center(
|
||||
child: Text('Smart Page'),
|
||||
);
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -8,20 +8,17 @@ class SplashView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//TODO remove this delay
|
||||
Future.delayed(
|
||||
const Duration(seconds: 3),
|
||||
() {
|
||||
Navigator.popAndPushNamed(
|
||||
context,
|
||||
Routes.authRoute,
|
||||
);
|
||||
},
|
||||
);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_forward),
|
||||
onPressed: () {
|
||||
Navigator.popAndPushNamed(
|
||||
context,
|
||||
Routes.authRoute,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Center(
|
||||
child: InkWell(
|
||||
//TODO check if user agreement is accepted
|
||||
|
||||
Reference in New Issue
Block a user