From 597bb604492853370f2771d609a7ddf779e90835 Mon Sep 17 00:00:00 2001 From: LollipopKit Date: Mon, 13 Sep 2021 16:33:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=BD=E5=B1=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/page/convert.dart | 8 ++++++-- lib/page/home.dart | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/lib/page/convert.dart b/lib/page/convert.dart index 31303d3b..fe0a8b5a 100644 --- a/lib/page/convert.dart +++ b/lib/page/convert.dart @@ -43,7 +43,8 @@ class _EncodePageState extends State Widget build(BuildContext context) { super.build(context); return Scaffold( - body: SingleChildScrollView( + body: GestureDetector( + child: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 7), child: AnimationLimiter( child: Column( @@ -61,7 +62,10 @@ class _EncodePageState extends State _buildTypeOption(), _buildResult(), ], - )))), + ))), + ), + onTap: () => FocusScope.of(context).requestFocus(FocusNode()), + ), floatingActionButton: FloatingActionButton( onPressed: () { _textEditingControllerResult.text = doConvert(); diff --git a/lib/page/home.dart b/lib/page/home.dart index 5eda0e25..525aedb8 100644 --- a/lib/page/home.dart +++ b/lib/page/home.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:toolbox/core/route.dart'; +import 'package:toolbox/data/res/build_data.dart'; import 'package:toolbox/page/convert.dart'; import 'package:toolbox/page/debug.dart'; @@ -37,6 +38,7 @@ class _MyHomePageState extends State controller: _tabController, ), ), + drawer: _buildDrawer(), body: TabBarView(controller: _tabController, children: const [ EncodePage(), EncodePage(), @@ -47,6 +49,38 @@ class _MyHomePageState extends State ); } + Widget _buildDrawer() { + return Drawer( + child: ListView( + padding: EdgeInsets.zero, + children: [ + UserAccountsDrawerHeader( + accountName: const Text('ToolBox'), + accountEmail: Text(_buildVersionStr()), + ), + const ListTile( + leading: Icon(Icons.settings), + title: Text('设置'), + ), + AboutListTile( + icon: const Icon(Icons.text_snippet), + child: const Text('开源证书'), + applicationName: BuildData.name, + applicationVersion: _buildVersionStr(), + aboutBoxChildren: const [ + Text('''\nMade with ❤️ by Toast Studio . + \nAll rights reserved.'''), + ], + ), + ], + ), + ); + } + + String _buildVersionStr() { + return 'Ver: 1.0.${BuildData.build}'; + } + @override bool get wantKeepAlive => true; }