From 0f7a9489a941267443f00fe994b2103290c9b3ec Mon Sep 17 00:00:00 2001 From: xh <36baea72@gmail.com> Date: Tue, 23 Jul 2024 16:44:42 +0800 Subject: [PATCH] 1 --- lib/page/home/home_view.dart | 346 ++++++++++++++++++----------------- 1 file changed, 174 insertions(+), 172 deletions(-) diff --git a/lib/page/home/home_view.dart b/lib/page/home/home_view.dart index 64141ad..d92d956 100755 --- a/lib/page/home/home_view.dart +++ b/lib/page/home/home_view.dart @@ -31,178 +31,14 @@ class HomePage extends StatelessWidget { children: [ _buildHead(), Expanded( - child: SingleChildScrollView( - child: Column( - children: [ - _buildDailyQuote(), - Column( - children: [ - const SizedBox(height: 66), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - children: [ - GestureDetector( - onTap: logic.onTapPhotos, - child: Container( - width: 72, - height: 72, - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - color: const Color(0xffD2FFFB), - borderRadius: BorderRadius.circular(36), - ), - child: Image.asset( - Assets.imagesPhoto, - ), - ), - ), - const Padding( - padding: EdgeInsets.only(top: 10), - child: Text( - "Photo", - style: TextStyle( - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ), - ) - ], - ), - Column( - children: [ - GestureDetector( - onTap: logic.openFaceToFace, - child: Container( - width: 72, - height: 72, - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - color: const Color(0xffE1E2FE), - borderRadius: BorderRadius.circular(36), - ), - child: Image.asset( - Assets.imagesDialog, - ), - ), - ), - const Padding( - padding: EdgeInsets.only(top: 10), - child: Text( - "Face2face", - style: TextStyle( - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ), - ) - ], - ), - Column( - children: [ - GestureDetector( - onTap: logic.openTranslateHistory, - child: Container( - width: 72, - height: 72, - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - color: const Color(0xffFEE5C5), - borderRadius: BorderRadius.circular(36), - ), - child: Image.asset( - Assets.imagesHistory, - ), - ), - ), - const Padding( - padding: EdgeInsets.only(top: 10), - child: Text( - "History", - style: TextStyle( - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ), - ) - ], - ), - ], - ), - const SizedBox(height: 96), - Column( - children: [ - GestureDetector( - onTap: logic.openTranslate, - child: Container( - height: 76, - alignment: Alignment.center, - decoration: BoxDecoration( - color: const Color.fromARGB( - 213, - 69, - 168, - 254, - ), - borderRadius: BorderRadius.circular(16), - border: Border.all( - width: 1.5, - color: const Color(0xff0087FF), - ), - ), - child: Row( - children: [ - const Expanded( - child: Padding( - padding: EdgeInsets.only(left: 20), - child: Text( - "Type to Translate", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w400, - color: Colors.white, - ), - ), - ), - ), - Padding( - padding: const EdgeInsets.only( - right: 20, - ), - child: GestureDetector( - onTap: logic.onTapSpeak, - child: Container( - height: 36, - width: 36, - padding: const EdgeInsets.all(5), - decoration: BoxDecoration( - color: const Color(0xff8BCFFE), - borderRadius: - BorderRadius.circular(18), - ), - child: SvgPicture.asset( - Assets.svgHomeVoice, - ), - ), - ), - ), - ], - ), - ), - ), - const SizedBox(height: 20), - const LanguageBar(), - const SizedBox(height: 20), - ], - ), - ], - ), - ], - ), + child: Column( + children: [ + _buildDailyQuote(), + Expanded(child: Container()), + _buildTools(), + Expanded(child: Container()), + _buildTranslate(), + ], ), ), ], @@ -446,4 +282,170 @@ class HomePage extends StatelessWidget { ], ); } + + Widget _buildTools() { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + children: [ + GestureDetector( + onTap: logic.onTapPhotos, + child: Container( + width: 72, + height: 72, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: const Color(0xffD2FFFB), + borderRadius: BorderRadius.circular(36), + ), + child: Image.asset( + Assets.imagesPhoto, + ), + ), + ), + const Padding( + padding: EdgeInsets.only(top: 10), + child: Text( + "Photo", + style: TextStyle( + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ), + ) + ], + ), + Column( + children: [ + GestureDetector( + onTap: logic.openFaceToFace, + child: Container( + width: 72, + height: 72, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: const Color(0xffE1E2FE), + borderRadius: BorderRadius.circular(36), + ), + child: Image.asset( + Assets.imagesDialog, + ), + ), + ), + const Padding( + padding: EdgeInsets.only(top: 10), + child: Text( + "Face2face", + style: TextStyle( + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ), + ) + ], + ), + Column( + children: [ + GestureDetector( + onTap: logic.openTranslateHistory, + child: Container( + width: 72, + height: 72, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: const Color(0xffFEE5C5), + borderRadius: BorderRadius.circular(36), + ), + child: Image.asset( + Assets.imagesHistory, + ), + ), + ), + const Padding( + padding: EdgeInsets.only(top: 10), + child: Text( + "History", + style: TextStyle( + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ), + ) + ], + ), + ], + ); + } + + Widget _buildTranslate() { + return Column( + children: [ + GestureDetector( + onTap: logic.openTranslate, + child: Container( + height: 76, + alignment: Alignment.center, + decoration: BoxDecoration( + color: const Color.fromARGB( + 213, + 69, + 168, + 254, + ), + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1.5, + color: const Color(0xff0087FF), + ), + ), + child: Row( + children: [ + const Expanded( + child: Padding( + padding: EdgeInsets.only(left: 20), + child: Text( + "Type to Translate", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.w400, + color: Colors.white, + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.only( + right: 20, + ), + child: GestureDetector( + onTap: logic.onTapSpeak, + child: Container( + height: 36, + width: 36, + padding: const EdgeInsets.all(5), + decoration: BoxDecoration( + color: const Color(0xff8BCFFE), + borderRadius: + BorderRadius.circular(18), + ), + child: SvgPicture.asset( + Assets.svgHomeVoice, + ), + ), + ), + ), + ], + ), + ), + ), + const SizedBox(height: 20), + const LanguageBar(), + const SizedBox(height: 20), + ], + ); + } }