mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
access management design revamp, responsiveness and buttons
This commit is contained in:
@ -3,63 +3,125 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
||||
import 'package:syncrow_web/pages/home/bloc/home_state.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class WebAppBar extends StatelessWidget {
|
||||
class WebAppBar extends StatelessWidget with HelperResponsiveLayout {
|
||||
final Widget? title;
|
||||
final List<Widget>? body;
|
||||
const WebAppBar({super.key, this.title, this.body});
|
||||
final Widget? centerBody;
|
||||
final Widget? rightBody;
|
||||
|
||||
const WebAppBar({super.key, this.title, this.centerBody, this.rightBody});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool isSmallScreen = isSmallScreenSize(context);
|
||||
|
||||
return BlocBuilder<HomeBloc, HomeState>(builder: (context, state) {
|
||||
return Container(
|
||||
height: 100,
|
||||
height: isSmallScreen ? 130 : 100,
|
||||
decoration: const BoxDecoration(color: ColorsManager.secondaryColor),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: title!,
|
||||
),
|
||||
if (body != null)
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Wrap(
|
||||
spacing: 15, // Adjust the spacing as needed
|
||||
children: body!,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
const SizedBox.square(
|
||||
dimension: 40,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
child: SizedBox.square(
|
||||
dimension: 35,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.grey,
|
||||
child: FlutterLogo(),
|
||||
child: isSmallScreen
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (title != null)
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: title!,
|
||||
),
|
||||
if (centerBody != null)
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: centerBody,
|
||||
),
|
||||
),
|
||||
if (rightBody != null || HomeBloc.user != null)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (rightBody != null) rightBody!,
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox.square(
|
||||
dimension: 40,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
child: SizedBox.square(
|
||||
dimension: 35,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.grey,
|
||||
child: FlutterLogo(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
if (HomeBloc.user != null)
|
||||
Text(
|
||||
'${HomeBloc.user!.firstName} ${HomeBloc.user!.lastName}',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: title!,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
if (HomeBloc.user != null)
|
||||
Text(
|
||||
'${HomeBloc.user!.firstName.toString()} ${HomeBloc.user!.lastName.toString()} ',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
if (centerBody != null)
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: centerBody,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (rightBody != null)
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: rightBody,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
const SizedBox.square(
|
||||
dimension: 40,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
child: SizedBox.square(
|
||||
dimension: 35,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.grey,
|
||||
child: FlutterLogo(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
if (HomeBloc.user != null)
|
||||
Text(
|
||||
'${HomeBloc.user!.firstName} ${HomeBloc.user!.lastName}',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -8,14 +8,17 @@ import 'menu_sidebar.dart';
|
||||
class WebScaffold extends StatelessWidget with HelperResponsiveLayout {
|
||||
final bool enableMenuSideba;
|
||||
final Widget? appBarTitle;
|
||||
final List<Widget>? appBarBody;
|
||||
final Widget? centerBody;
|
||||
final Widget? rightBody;
|
||||
final Widget? scaffoldBody;
|
||||
const WebScaffold(
|
||||
{super.key,
|
||||
this.appBarTitle,
|
||||
this.appBarBody,
|
||||
this.scaffoldBody,
|
||||
this.enableMenuSideba = true});
|
||||
const WebScaffold({
|
||||
super.key,
|
||||
this.appBarTitle,
|
||||
this.centerBody,
|
||||
this.rightBody,
|
||||
this.scaffoldBody,
|
||||
this.enableMenuSideba = true,
|
||||
});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isSmall = isSmallScreenSize(context);
|
||||
@ -40,7 +43,8 @@ class WebScaffold extends StatelessWidget with HelperResponsiveLayout {
|
||||
opacity: 0.7,
|
||||
child: WebAppBar(
|
||||
title: appBarTitle,
|
||||
body: appBarBody,
|
||||
centerBody: centerBody,
|
||||
rightBody: rightBody,
|
||||
)),
|
||||
Expanded(
|
||||
child: Row(
|
||||
|
Reference in New Issue
Block a user