mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
initialized Dashboard Page
This commit is contained in:
@ -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});
|
||||
}
|
28
lib/features/shared_widgets/text_widgets/body_large.dart
Normal file
28
lib/features/shared_widgets/text_widgets/body_large.dart
Normal file
@ -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,
|
||||
);
|
||||
}
|
31
lib/features/shared_widgets/text_widgets/body_medium.dart
Normal file
31
lib/features/shared_widgets/text_widgets/body_medium.dart
Normal file
@ -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,
|
||||
);
|
||||
}
|
28
lib/features/shared_widgets/text_widgets/body_small.dart
Normal file
28
lib/features/shared_widgets/text_widgets/body_small.dart
Normal file
@ -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,
|
||||
);
|
||||
}
|
||||
}
|
24
lib/features/shared_widgets/text_widgets/display_large.dart
Normal file
24
lib/features/shared_widgets/text_widgets/display_large.dart
Normal file
@ -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,
|
||||
);
|
||||
}
|
20
lib/features/shared_widgets/text_widgets/display_medium.dart
Normal file
20
lib/features/shared_widgets/text_widgets/display_medium.dart
Normal file
@ -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,
|
||||
);
|
||||
}
|
25
lib/features/shared_widgets/text_widgets/display_small.dart
Normal file
25
lib/features/shared_widgets/text_widgets/display_small.dart
Normal file
@ -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,
|
||||
),
|
||||
);
|
||||
}
|
20
lib/features/shared_widgets/text_widgets/title_large.dart
Normal file
20
lib/features/shared_widgets/text_widgets/title_large.dart
Normal file
@ -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,
|
||||
),
|
||||
);
|
||||
}
|
28
lib/features/shared_widgets/text_widgets/title_medium.dart
Normal file
28
lib/features/shared_widgets/text_widgets/title_medium.dart
Normal file
@ -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,
|
||||
);
|
||||
}
|
24
lib/features/shared_widgets/text_widgets/title_small.dart
Normal file
24
lib/features/shared_widgets/text_widgets/title_small.dart
Normal file
@ -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,
|
||||
);
|
||||
}
|
63
lib/features/shared_widgets/united_text.dart
Normal file
63
lib/features/shared_widgets/united_text.dart
Normal file
@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user