123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import 'package:flutter/material.dart';
- import 'package:touch_demonstrator/pages/SideBarContent.dart';
-
- class LeftDrawer extends StatelessWidget {
- static const htmlPrivacyNotes = 'assets/html/privacy_notice.html';
- static const htmlImprint = 'assets/html/imprint.html';
- static const htmlTermsOfUse = 'assets/html/terms_of_use.html';
- static const htmlDisclaimer = 'assets/html/disclaimer.html';
- static const headerText = Text(
- 'Touch Demonstrator App',
- textScaleFactor: 1.5,
- style: TextStyle(color: Colors.white),
- );
-
- DrawerHeader _buildHeader(BuildContext context) {
- return DrawerHeader(
- key: Key('DrawerHeader'),
- child: headerText,
- decoration: BoxDecoration(color: Theme.of(context).primaryColor),
- );
- }
-
- ListTile _buildTile(BuildContext context, String title, String html) {
- return ListTile(
- key: Key(title),
- title: Text(title),
- onTap: () {
- Navigator.pop(context);
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (BuildContext context) =>
- SideBarContent(title: title, html: html)));
- },
- );
- }
-
- @override
- Widget build(BuildContext context) {
- return Drawer(
- key: Key('Drawer'),
- child: ListView(
- padding: EdgeInsets.zero,
- children: <Widget>[
- _buildHeader(context),
- _buildTile(context, 'Privacy Notes', htmlPrivacyNotes),
- _buildTile(context, 'Imprint', htmlImprint),
- _buildTile(context, 'Terms of Use', htmlTermsOfUse),
- _buildTile(context, 'Disclaimer', htmlDisclaimer),
- ],
- ),
- );
- }
- }
|