Settings
This commit is contained in:
parent
8c19bcd67e
commit
e957c0085c
|
|
@ -34,7 +34,8 @@ class _InvoiceEmailViewState extends State<InvoiceEmailView>
|
||||||
String _emailBody;
|
String _emailBody;
|
||||||
String _lastSubject;
|
String _lastSubject;
|
||||||
String _lastBody;
|
String _lastBody;
|
||||||
String _templatePreview = '';
|
String _bodyPreview = '';
|
||||||
|
String _subjectPreview = '';
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
|
||||||
final _debouncer = Debouncer();
|
final _debouncer = Debouncer();
|
||||||
|
|
@ -161,7 +162,8 @@ class _InvoiceEmailViewState extends State<InvoiceEmailView>
|
||||||
onComplete: (subject, body) {
|
onComplete: (subject, body) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
//_templatePreview = 'data:text/html;base64,$response';
|
_subjectPreview = subject;
|
||||||
|
_bodyPreview = body;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -170,6 +172,7 @@ class _InvoiceEmailViewState extends State<InvoiceEmailView>
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
color: Theme.of(context).backgroundColor,
|
color: Theme.of(context).backgroundColor,
|
||||||
|
|
@ -210,17 +213,10 @@ class _InvoiceEmailViewState extends State<InvoiceEmailView>
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: EmailPreview(
|
||||||
children: <Widget>[
|
isLoading: _isLoading,
|
||||||
Expanded(
|
subject: _subjectPreview,
|
||||||
child: TemplatePreview(_templatePreview),
|
body: _bodyPreview,
|
||||||
),
|
|
||||||
if (_isLoading)
|
|
||||||
SizedBox(
|
|
||||||
height: 4.0,
|
|
||||||
child: LinearProgressIndicator(),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -354,34 +354,10 @@ class _TemplatesAndRemindersState extends State<TemplatesAndReminders>
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(
|
EmailPreview(
|
||||||
color: Colors.white,
|
isLoading: _isLoading,
|
||||||
//padding: const EdgeInsets.all(10),
|
subject: _subjectPreview,
|
||||||
child: Column(
|
body: _bodyPreview,
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Padding(
|
|
||||||
child: Text(
|
|
||||||
_subjectPreview,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.only(left: 8, top: 12, bottom: 8, right: 8),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: TemplatePreview(_bodyPreview),
|
|
||||||
),
|
|
||||||
if (_isLoading)
|
|
||||||
SizedBox(
|
|
||||||
height: 4.0,
|
|
||||||
child: LinearProgressIndicator(),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -578,3 +554,48 @@ class _TemplatePreviewState extends State<TemplatePreview>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class EmailPreview extends StatelessWidget {
|
||||||
|
const EmailPreview({
|
||||||
|
@required this.subject,
|
||||||
|
@required this.body,
|
||||||
|
@required this.isLoading,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String subject;
|
||||||
|
final String body;
|
||||||
|
final bool isLoading;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 8, top: 12, bottom: 8, right: 8),
|
||||||
|
child: Text(
|
||||||
|
subject,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TemplatePreview(body),
|
||||||
|
),
|
||||||
|
if (isLoading)
|
||||||
|
SizedBox(
|
||||||
|
height: 4.0,
|
||||||
|
child: LinearProgressIndicator(),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue