feat: current user
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import '../../../../application/auth/auth_bloc.dart';
|
||||
import '../../../../common/constant/app_constant.dart';
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/painter/wave_painter.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../domain/auth/auth.dart';
|
||||
import '../../../components/spacer/spacer.dart';
|
||||
|
||||
class HomeHeader extends StatefulWidget {
|
||||
@@ -102,43 +106,47 @@ class _HomeHeaderState extends State<HomeHeader> with TickerProviderStateMixin {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedBuilder(
|
||||
animation: Listenable.merge([
|
||||
_particleController,
|
||||
_waveController,
|
||||
_breathController,
|
||||
]),
|
||||
builder: (context, child) {
|
||||
return Container(
|
||||
height: 280,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColor.primary,
|
||||
AppColor.primaryLight,
|
||||
AppColor.primaryLight.withOpacity(0.8),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
stops: const [0.0, 0.7, 1.0],
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.primary.withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 10),
|
||||
return BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, state) {
|
||||
return AnimatedBuilder(
|
||||
animation: Listenable.merge([
|
||||
_particleController,
|
||||
_waveController,
|
||||
_breathController,
|
||||
]),
|
||||
builder: (context, child) {
|
||||
return Container(
|
||||
height: 280,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColor.primary,
|
||||
AppColor.primaryLight,
|
||||
AppColor.primaryLight.withOpacity(0.8),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
stops: const [0.0, 0.7, 1.0],
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.primary.withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
// Enhanced animated background
|
||||
_buildAnimatedBackground(),
|
||||
child: Stack(
|
||||
children: [
|
||||
// Enhanced animated background
|
||||
_buildAnimatedBackground(),
|
||||
|
||||
// Main content
|
||||
SafeArea(child: _buildContent(context)),
|
||||
],
|
||||
),
|
||||
// Main content
|
||||
SafeArea(child: _buildContent(context, state.user)),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -255,7 +263,7 @@ class _HomeHeaderState extends State<HomeHeader> with TickerProviderStateMixin {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContent(BuildContext context) {
|
||||
Widget _buildContent(BuildContext context, User user) {
|
||||
String greeting(BuildContext context) {
|
||||
final hour = DateTime.now().hour;
|
||||
|
||||
@@ -291,7 +299,7 @@ class _HomeHeaderState extends State<HomeHeader> with TickerProviderStateMixin {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'AppSkel POS Owner',
|
||||
AppConstant.appName,
|
||||
style: AppStyle.lg.copyWith(
|
||||
color: AppColor.white.withOpacity(0.9),
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -307,7 +315,7 @@ class _HomeHeaderState extends State<HomeHeader> with TickerProviderStateMixin {
|
||||
),
|
||||
const SpaceHeight(2),
|
||||
Text(
|
||||
'Manager',
|
||||
user.role.toTitleCase,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.white.withOpacity(0.7),
|
||||
fontSize: 11,
|
||||
@@ -383,7 +391,7 @@ class _HomeHeaderState extends State<HomeHeader> with TickerProviderStateMixin {
|
||||
),
|
||||
const SpaceHeight(2),
|
||||
Text(
|
||||
'Vira Vania! 👋',
|
||||
'${user.name}! 👋',
|
||||
style: AppStyle.h4.copyWith(
|
||||
color: AppColor.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
|
||||
Reference in New Issue
Block a user