Onboarding completato, ora super rapido e top Reviewed-on: http://catelliub.zapto.org:3000/brontomark/flux/pulls/7 Co-authored-by: Mark M2 Macbook <marco@catelli.it> Co-committed-by: Mark M2 Macbook <marco@catelli.it>
126 lines
3.9 KiB
Dart
126 lines
3.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flux/core/blocs/session/session_cubit.dart';
|
|
import 'package:flux/core/theme/theme.dart';
|
|
import 'package:flux/features/home/ui/dashboard_adaptive_grid.dart';
|
|
|
|
class DashboardContent extends StatelessWidget {
|
|
final bool isLargeScreen;
|
|
final Function(int)? onTabRequested;
|
|
|
|
const DashboardContent({
|
|
super.key,
|
|
this.isLargeScreen = false,
|
|
this.onTabRequested,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<SessionCubit, SessionState>(
|
|
builder: (context, state) {
|
|
final store = state.currentStore;
|
|
final company = state.company;
|
|
|
|
return Scaffold(
|
|
backgroundColor: context.background,
|
|
body: CustomScrollView(
|
|
slivers: [
|
|
SliverAppBar(
|
|
expandedHeight: 100.0,
|
|
floating: false,
|
|
pinned: true,
|
|
elevation: 0,
|
|
backgroundColor: context.background,
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
titlePadding: const EdgeInsets.only(left: 24, bottom: 16),
|
|
title: Text(
|
|
store?.nome ?? 'Dashboard',
|
|
style: TextStyle(
|
|
color: context.primaryText,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SliverToBoxAdapter(
|
|
child: Center(
|
|
child: Container(
|
|
constraints: const BoxConstraints(maxWidth: 1200),
|
|
padding: const EdgeInsets.all(24.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
_buildWelcome(context, company?.ragioneSociale),
|
|
const SizedBox(height: 32),
|
|
const _SectionTitle(title: 'AZIONI RAPIDE'),
|
|
const SizedBox(height: 16),
|
|
DashboardAdaptiveGrid(
|
|
isLargeScreen: isLargeScreen,
|
|
onTabRequested: onTabRequested,
|
|
),
|
|
const SizedBox(height: 40),
|
|
const _SectionTitle(title: 'INFO PUNTO VENDITA'),
|
|
const SizedBox(height: 16),
|
|
_buildStoreCard(context, store),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _buildWelcome(BuildContext context, String? name) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'Benvenuto in',
|
|
style: TextStyle(color: context.secondaryText, fontSize: 16),
|
|
),
|
|
Text(
|
|
name ?? 'Azienda',
|
|
style: const TextStyle(fontSize: 28, fontWeight: FontWeight.w900),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildStoreCard(BuildContext context, dynamic store) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(20),
|
|
decoration: BoxDecoration(
|
|
color: context.accent.withValues(alpha: 0.05),
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(color: context.accent.withValues(alpha: 0.1)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(Icons.location_on, color: context.accent),
|
|
const SizedBox(width: 16),
|
|
Text('${store?.indirizzo}, ${store?.comune} (${store?.provincia})'),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _SectionTitle extends StatelessWidget {
|
|
final String title;
|
|
const _SectionTitle({required this.title});
|
|
@override
|
|
Widget build(BuildContext context) => Text(
|
|
title,
|
|
style: TextStyle(
|
|
color: context.accent,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 12,
|
|
letterSpacing: 1.2,
|
|
),
|
|
);
|
|
}
|