Masterarbeit Richard Stern. Flutter App, sich mit einem Bluetooth-Gerät verbindet und Berührungen auf einem Sensor visualisiert.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SideBar.dart 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import 'package:flutter/material.dart';
  2. import 'package:touch_demonstrator/pages/SideBarContent.dart';
  3. class LeftDrawer extends StatelessWidget {
  4. static const htmlPrivacyNotes = 'assets/html/privacy_notice.html';
  5. static const htmlImprint = 'assets/html/imprint.html';
  6. static const htmlTermsOfUse = 'assets/html/terms_of_use.html';
  7. static const htmlDisclaimer = 'assets/html/disclaimer.html';
  8. static const headerText = Text(
  9. 'Touch Demonstrator App',
  10. textScaleFactor: 1.5,
  11. style: TextStyle(color: Colors.white),
  12. );
  13. DrawerHeader _buildHeader(BuildContext context) {
  14. return DrawerHeader(
  15. key: Key('DrawerHeader'),
  16. child: headerText,
  17. decoration: BoxDecoration(color: Theme.of(context).primaryColor),
  18. );
  19. }
  20. ListTile _buildTile(BuildContext context, String title, String html) {
  21. return ListTile(
  22. key: Key(title),
  23. title: Text(title),
  24. onTap: () {
  25. Navigator.pop(context);
  26. Navigator.push(
  27. context,
  28. MaterialPageRoute(
  29. builder: (BuildContext context) =>
  30. SideBarContent(title: title, html: html)));
  31. },
  32. );
  33. }
  34. @override
  35. Widget build(BuildContext context) {
  36. return Drawer(
  37. key: Key('Drawer'),
  38. child: ListView(
  39. padding: EdgeInsets.zero,
  40. children: <Widget>[
  41. _buildHeader(context),
  42. _buildTile(context, 'Privacy Notes', htmlPrivacyNotes),
  43. _buildTile(context, 'Imprint', htmlImprint),
  44. _buildTile(context, 'Terms of Use', htmlTermsOfUse),
  45. _buildTile(context, 'Disclaimer', htmlDisclaimer),
  46. ],
  47. ),
  48. );
  49. }
  50. }