From 6e444f46fbeb807fc45a13346bfbb1f9e6f399a8 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 13 Sep 2025 13:23:04 +0800 Subject: [PATCH] :lipstick: Optimize designs --- lib/screens/calculator_home_page.dart | 37 ++++++++++++++++----------- pubspec.yaml | 2 +- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/lib/screens/calculator_home_page.dart b/lib/screens/calculator_home_page.dart index 85efbc9..d5b4bba 100644 --- a/lib/screens/calculator_home_page.dart +++ b/lib/screens/calculator_home_page.dart @@ -1,3 +1,4 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:latext/latext.dart'; @@ -104,7 +105,12 @@ class _CalculatorHomePageState extends State { floatingLabelAlignment: FloatingLabelAlignment.center, hintText: '例如: 2x^2 - 8x + 6 = 0', ), - keyboardType: TextInputType.number, + keyboardType: kIsWeb + ? TextInputType.numberWithOptions( + signed: true, + decimal: true, + ) + : TextInputType.number, onSubmitted: (_) => _solveEquation(), ), ), @@ -241,13 +247,13 @@ class _CalculatorHomePageState extends State { return Material( elevation: 8, child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12), + padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 8), child: Column( mainAxisSize: MainAxisSize.min, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, - spacing: 16, + spacing: 8, children: [ Expanded( child: Tooltip( @@ -299,7 +305,7 @@ class _CalculatorHomePageState extends State { const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, - spacing: 16, + spacing: 8, children: [ Expanded( child: Tooltip( @@ -357,18 +363,19 @@ class _CalculatorHomePageState extends State { ), ], ), - const SizedBox(height: 8), - Row( - children: [ - Expanded( - child: FilledButton.icon( - icon: const Icon(Icons.keyboard_hide), - onPressed: () => _focusNode.unfocus(), - label: Text('收起键盘'), + if (!kIsWeb) const SizedBox(height: 8), + if (!kIsWeb) + Row( + children: [ + Expanded( + child: FilledButton.icon( + icon: const Icon(Icons.keyboard_hide), + onPressed: () => _focusNode.unfocus(), + label: Text('收起键盘'), + ), ), - ), - ], - ), + ], + ), ], ), ), diff --git a/pubspec.yaml b/pubspec.yaml index a456cd8..1fcc44d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 +version: 1.0.0+2 environment: sdk: ^3.9.2