From 8414ae862001ec8819eef855e09ffaed985e6a2c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 23 Mar 2022 11:21:41 +0200 Subject: [PATCH] Add super editor --- lib/ui/app/invoice/invoice_email_view.dart | 38 ++++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/lib/ui/app/invoice/invoice_email_view.dart b/lib/ui/app/invoice/invoice_email_view.dart index 06072d943..f8692404e 100644 --- a/lib/ui/app/invoice/invoice_email_view.dart +++ b/lib/ui/app/invoice/invoice_email_view.dart @@ -182,14 +182,16 @@ class _InvoiceEmailViewState extends State DropdownButtonHideUnderline( child: DropdownButton( value: selectedTemplate, - onChanged: (template) { - setState(() { - _subjectController.text = ''; - _bodyController.text = ''; - selectedTemplate = template; - _loadTemplate(); - }); - }, + onChanged: _isLoading + ? null + : (template) { + setState(() { + _subjectController.text = ''; + _bodyController.text = ''; + selectedTemplate = template; + _loadTemplate(); + }); + }, items: [ DropdownMenuItem( child: Text(localization.initialEmail), @@ -306,12 +308,20 @@ class _InvoiceEmailViewState extends State Expanded( child: Material( color: Colors.white, - child: ExampleEditor( - value: _rawBodyPreview, - onChanged: (value) { - _bodyController.text = value; - _onChanged(); - }, + child: Stack( + children: [ + if (_isLoading) LinearProgressIndicator(), + ExampleEditor( + value: _rawBodyPreview, + onChanged: (value) { + _bodyController.text = value; + // TODO remove check once browser is supported + if (!isDesktopOS()) { + _onChanged(); + } + }, + ), + ], ), ), ),