Flutter code samples
Example of a custom Flutter component
Dart Example
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_layer/services/hive.service.dart';
import 'package:flutter_layer/services/settings.service.dart';
import 'package:flutter_layer/localization/localizations.dart';
class WyCustomComponent_SampleComponent extends StatelessWidget {
Widget build(BuildContext context) {
final settings = SettingsService.getInstance();
final appVersion = settings.getAppVersion();
return SingleChildScrollView(
padding: EdgeInsets.all(20.0), child: Html(data: '''
<div>
<h1>${AppLocalizations.of(context)!.get('@@AboutHelloWorld', 'About HelloWorld')} $appVersion</h1>
<br>
HelloWorld is a product of ...
<br>
Visit <a href="https://my.app">my.app</a> for more info.
<br>
<br>
© 2022 ...
<br>
<br>
<div style="color: #888;">
Environment: ${settings.getDeploymentName()}<br>
Storage key: ${HiveService.getCurrentStorageKey()}<br>
User: ${settings.getUserName()}<br>
Tenant: ${settings.getTenant()}
</div>
<br>
</div>
'''));
}
}