Fix desktop and sliver app bar add client

This commit is contained in:
Juan Gilsanz Polo 2024-03-09 13:57:15 +01:00
parent ad6cb92d4b
commit ce8d38958e
2 changed files with 91 additions and 69 deletions

View file

@ -235,9 +235,16 @@ class _ClientScreenState extends State<ClientScreen> {
if (widget.fullScreen == true) { if (widget.fullScreen == true) {
return Dialog.fullscreen( return Material(
child: Scaffold( child: NestedScrollView(
appBar: AppBar( headerSliverBuilder: (context, innerBoxIsScrolled) => [
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar.large(
pinned: true,
floating: true,
centerTitle: false,
forceElevated: innerBoxIsScrolled,
leading: IconButton( leading: IconButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
icon: const Icon(Icons.close) icon: const Icon(Icons.close)
@ -248,10 +255,19 @@ class _ClientScreenState extends State<ClientScreen> {
: AppLocalizations.of(context)!.addClient : AppLocalizations.of(context)!.addClient
), ),
actions: actions(), actions: actions(),
), )
)
],
body: SafeArea( body: SafeArea(
child: ListView( top: false,
controller: _scrollController, bottom: true,
child: Builder(
builder: (context) => CustomScrollView(
slivers: [
SliverOverlapInjector(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
),
SliverList.list(
children: [ children: [
if (!_nameValid || !_identifiersValid || !_dnsCacheValid) _Errors( if (!_nameValid || !_identifiersValid || !_dnsCacheValid) _Errors(
nameValid: _nameValid, nameValid: _nameValid,
@ -298,8 +314,11 @@ class _ClientScreenState extends State<ClientScreen> {
setBlockedServicesSchedule: (v) => setState(() => _blockedServicesSchedule = v), setBlockedServicesSchedule: (v) => setState(() => _blockedServicesSchedule = v),
), ),
], ],
)
],
), ),
), )
)
), ),
); );
} }

View file

@ -148,11 +148,14 @@ class LogTile extends StatelessWidget {
} }
void openAddClient() { void openAddClient() {
openClientFormModal( Future.delayed(
const Duration(milliseconds: 0),
() => openClientFormModal(
context: context, context: context,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
onConfirm: confirmAddClient, onConfirm: confirmAddClient,
initialData: ClientInitialData(name: "Client ${log.client}", ip: log.client) initialData: ClientInitialData(name: "Client ${log.client}", ip: log.client)
)
); );
} }