mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-23 06:38:35 +02:00
Fix some colors (#2293)
* Fix some colors * fix(theme-updates): Modify condition for theme border style display when hasUnderlineBorder is true * fix(themes-updates): Adjust switch colors and modify payjoin hint text * fix: Crash report relating to success image display on successful exchange * fix(theme-updates): Adjust animated text max width to prevent overflows * fix(theme-updates): Adjust fee picker styling * fix(themes-updates): Remove text overflow on welcome screen animation --------- Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
This commit is contained in:
@@ -33,10 +33,9 @@ class _AnimatedTypingTextState extends State<AnimatedTypingText> with TickerProv
|
||||
|
||||
String _displayText = '';
|
||||
|
||||
double _maxTextWidth = 0;
|
||||
int _currentWordIndex = 0;
|
||||
int _currentCharIndex = 0;
|
||||
|
||||
|
||||
bool _isTyping = true;
|
||||
bool _isPaused = false;
|
||||
bool _isWaitingForPause = false;
|
||||
@@ -61,10 +60,6 @@ class _AnimatedTypingTextState extends State<AnimatedTypingText> with TickerProv
|
||||
),
|
||||
);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_calculateMaxTextWidth();
|
||||
});
|
||||
|
||||
_controller.addStatusListener((status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
_updateText();
|
||||
@@ -78,24 +73,6 @@ class _AnimatedTypingTextState extends State<AnimatedTypingText> with TickerProv
|
||||
_controller.forward();
|
||||
}
|
||||
|
||||
void _calculateMaxTextWidth() {
|
||||
final textStyle = widget.style ?? DefaultTextStyle.of(context).style;
|
||||
double maxWidth = 0;
|
||||
final textPainter = TextPainter(
|
||||
textDirection: TextDirection.ltr,
|
||||
);
|
||||
for (final word in widget.words) {
|
||||
textPainter.text = TextSpan(text: word, style: textStyle);
|
||||
textPainter.layout();
|
||||
if (textPainter.width > maxWidth) {
|
||||
maxWidth = textPainter.width;
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
_maxTextWidth = maxWidth;
|
||||
});
|
||||
}
|
||||
|
||||
void _updateText() {
|
||||
if (_isWaitingForPause) return;
|
||||
|
||||
@@ -157,38 +134,35 @@ class _AnimatedTypingTextState extends State<AnimatedTypingText> with TickerProv
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: _maxTextWidth + widget.cursorWidth,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
// Fixed cursor position
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: AnimatedBuilder(
|
||||
animation: _cursorAnimation,
|
||||
builder: (context, child) {
|
||||
return Opacity(
|
||||
opacity: _cursorAnimation.value,
|
||||
child: Container(
|
||||
width: widget.cursorWidth,
|
||||
height: widget.cursorHeight,
|
||||
color: widget.cursorColor,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
// Fixed cursor position
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: AnimatedBuilder(
|
||||
animation: _cursorAnimation,
|
||||
builder: (context, child) {
|
||||
return Opacity(
|
||||
opacity: _cursorAnimation.value,
|
||||
child: Container(
|
||||
width: widget.cursorWidth,
|
||||
height: widget.cursorHeight,
|
||||
color: widget.cursorColor,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
// Animated text
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
_displayText + ' ',
|
||||
style: widget.style,
|
||||
),
|
||||
),
|
||||
// Animated text
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
_displayText + ' ',
|
||||
style: widget.style,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +135,15 @@ class BaseTextFormField extends StatelessWidget {
|
||||
hintText: hasUnderlineBorder ? hintText : null,
|
||||
labelText: !hasUnderlineBorder ? hintText : null,
|
||||
labelStyle: !hasUnderlineBorder ? placeholderTextStyle : null,
|
||||
border: hasUnderlineBorder
|
||||
? UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.outlineVariant,
|
||||
style: borderWidth == 0.0 ? BorderStyle.none : BorderStyle.solid,
|
||||
width: borderWidth,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
focusedBorder: hasUnderlineBorder
|
||||
? UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
@@ -156,7 +165,7 @@ class BaseTextFormField extends StatelessWidget {
|
||||
? UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.outlineVariant,
|
||||
style: borderWidth == 1 ? BorderStyle.none : BorderStyle.solid,
|
||||
style: borderWidth == 0.0 ? BorderStyle.none : BorderStyle.solid,
|
||||
width: borderWidth,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -144,7 +144,7 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
child: StandardSwitch(
|
||||
value: widget.doSingleScan,
|
||||
onTaped: () => widget.toggleSingleScan?.call(),
|
||||
onTapped: () => widget.toggleSingleScan?.call(),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'dart:math';
|
||||
|
||||
import 'package:cake_wallet/entities/seed_type.dart';
|
||||
import 'package:cake_wallet/src/widgets/search_bar_widget.dart';
|
||||
import 'package:cake_wallet/themes/utils/custom_theme_colors.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -157,7 +158,6 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 18,
|
||||
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
@@ -358,7 +358,6 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
||||
tag,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 7.0,
|
||||
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
@@ -430,7 +429,6 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
||||
softWrap: true,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
decoration: TextDecoration.none,
|
||||
@@ -448,7 +446,6 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
||||
tag,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 7.0,
|
||||
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
@@ -522,10 +519,16 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
||||
}
|
||||
|
||||
Widget buildSlider({required int index, required bool isActivated}) {
|
||||
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Slider(
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
inactiveColor: isDarkMode
|
||||
? CustomThemeColors.toggleColorOffStateDark
|
||||
: CustomThemeColors.toggleColorOffStateLight,
|
||||
thumbColor: CustomThemeColors.toggleKnobStateColorLight,
|
||||
value: widget.sliderValue == null || widget.sliderValue! < 1 ? 1 : widget.sliderValue!,
|
||||
onChanged: isActivated ? widget.onSliderChanged : null,
|
||||
min: widget.minValue ?? 1,
|
||||
|
||||
@@ -43,7 +43,7 @@ class _ServicesUpdatesWidgetState extends State<ServicesUpdatesWidget> {
|
||||
child: SvgPicture.asset(
|
||||
"assets/images/notification_icon.svg",
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
width: 30,
|
||||
width: 20,
|
||||
placeholderBuilder: (_) => Icon(Icons.error),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:cake_wallet/themes/utils/custom_theme_colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StandardSwitch extends StatefulWidget {
|
||||
const StandardSwitch({required this.value, required this.onTaped});
|
||||
const StandardSwitch({required this.value, required this.onTapped});
|
||||
|
||||
final bool value;
|
||||
final VoidCallback onTaped;
|
||||
final VoidCallback onTapped;
|
||||
|
||||
@override
|
||||
StandardSwitchState createState() => StandardSwitchState();
|
||||
@@ -14,10 +14,11 @@ class StandardSwitch extends StatefulWidget {
|
||||
class StandardSwitchState extends State<StandardSwitch> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
||||
return Semantics(
|
||||
toggled: widget.value,
|
||||
child: GestureDetector(
|
||||
onTap: widget.onTaped,
|
||||
onTap: widget.onTapped,
|
||||
child: AnimatedContainer(
|
||||
padding: EdgeInsets.only(left: 2.0, right: 2.0),
|
||||
alignment: widget.value ? Alignment.centerRight : Alignment.centerLeft,
|
||||
@@ -26,8 +27,10 @@ class StandardSwitchState extends State<StandardSwitch> {
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
color: widget.value
|
||||
? Theme.of(context).colorScheme.surfaceContainerHighest
|
||||
: Theme.of(context).colorScheme.surfaceContainerLowest,
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: isDarkMode
|
||||
? CustomThemeColors.toggleColorOffStateDark
|
||||
: CustomThemeColors.toggleColorOffStateLight,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(14.0),
|
||||
),
|
||||
@@ -36,7 +39,9 @@ class StandardSwitchState extends State<StandardSwitch> {
|
||||
width: 24.0,
|
||||
height: 24.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
color: isDarkMode
|
||||
? Theme.of(context).colorScheme.surface
|
||||
: CustomThemeColors.toggleKnobStateColorLight,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user