refactor: Remove bubble size slider

This commit is contained in:
Krille 2023-08-11 13:33:16 +02:00
parent d6b48091c4
commit 6bd518fa36
No known key found for this signature in database
7 changed files with 18 additions and 46 deletions

View file

@ -9,7 +9,6 @@ abstract class AppConfig {
static String? get applicationWelcomeMessage => _applicationWelcomeMessage;
static String _defaultHomeserver = 'matrix.org';
static String get defaultHomeserver => _defaultHomeserver;
static double bubbleSizeFactor = 1;
static double fontSizeFactor = 1;
static const Color chatColor = primaryColor;
static Color? colorSchemeSeed = primaryColor;

View file

@ -13,7 +13,6 @@ abstract class SettingKeys {
static const String amoledEnabled = 'amoled_enabled';
static const String codeLanguage = 'code_language';
static const String showNoGoogle = 'chat.fluffy.show_no_google';
static const String bubbleSizeFactor = 'chat.fluffy.bubble_size_factor';
static const String fontSizeFactor = 'chat.fluffy.font_size_factor';
static const String showNoPid = 'chat.fluffy.show_no_pid';
static const String databasePassword = 'database-password';

View file

@ -8,7 +8,6 @@ import 'package:just_audio/just_audio.dart';
import 'package:matrix/matrix.dart';
import 'package:path_provider/path_provider.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/utils/error_reporter.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart';
import '../../../utils/matrix_sdk_extensions/event_extension.dart';
@ -186,7 +185,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
Widget build(BuildContext context) {
final statusText = this.statusText ??= _durationString ?? '00:00';
return Padding(
padding: EdgeInsets.all(16 * AppConfig.bubbleSizeFactor),
padding: const EdgeInsets.all(16),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[

View file

@ -125,8 +125,8 @@ class Message extends StatelessWidget {
padding: const EdgeInsets.only(top: 8.0),
child: Center(
child: SizedBox(
width: 16 * AppConfig.bubbleSizeFactor,
height: 16 * AppConfig.bubbleSizeFactor,
width: 16,
height: 16,
child: event.status == EventStatus.sending
? const CircularProgressIndicator.adaptive(
strokeWidth: 2,
@ -201,9 +201,9 @@ class Message extends StatelessWidget {
),
padding: noBubble || noPadding
? EdgeInsets.zero
: EdgeInsets.symmetric(
horizontal: 16 * AppConfig.bubbleSizeFactor,
vertical: 8 * AppConfig.bubbleSizeFactor,
: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
constraints: const BoxConstraints(
maxWidth: FluffyThemes.columnWidth * 1.5,
@ -241,9 +241,8 @@ class Message extends StatelessWidget {
},
child: AbsorbPointer(
child: Container(
margin: EdgeInsets.symmetric(
vertical:
4.0 * AppConfig.bubbleSizeFactor,
margin: const EdgeInsets.symmetric(
vertical: 4.0,
),
child: ReplyContent(
replyEvent,
@ -265,8 +264,8 @@ class Message extends StatelessWidget {
RelationshipTypes.edit,
))
Padding(
padding: EdgeInsets.only(
top: 4.0 * AppConfig.bubbleSizeFactor,
padding: const EdgeInsets.only(
top: 4.0,
),
child: Row(
mainAxisSize: MainAxisSize.min,
@ -316,8 +315,8 @@ class Message extends StatelessWidget {
if (displayTime || selected)
Padding(
padding: displayTime
? EdgeInsets.symmetric(
vertical: 8.0 * AppConfig.bubbleSizeFactor,
? const EdgeInsets.symmetric(
vertical: 8.0,
)
: EdgeInsets.zero,
child: Center(
@ -345,7 +344,7 @@ class Message extends StatelessWidget {
if (event.hasAggregatedEvents(timeline, RelationshipTypes.reaction))
Padding(
padding: EdgeInsets.only(
top: 4.0 * AppConfig.bubbleSizeFactor,
top: 4.0,
left: (ownMessage ? 0 : Avatar.defaultSize) + 12.0,
right: 12.0,
),
@ -407,9 +406,9 @@ class Message extends StatelessWidget {
: Theme.of(context).primaryColor.withAlpha(0),
constraints:
const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5),
padding: EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric(
horizontal: 8.0,
vertical: 4.0 * AppConfig.bubbleSizeFactor,
vertical: 4.0,
),
child: container,
),

View file

@ -79,14 +79,6 @@ class SettingsStyleController extends State<SettingsStyle> {
);
}
void changeBubbleSizeFactor(double d) {
setState(() => AppConfig.bubbleSizeFactor = d);
Matrix.of(context).store.setItem(
SettingKeys.bubbleSizeFactor,
AppConfig.bubbleSizeFactor.toString(),
);
}
@override
Widget build(BuildContext context) => SettingsStyleView(this);
}

View file

@ -149,9 +149,9 @@ class SettingsStyleView extends StatelessWidget {
color: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16 * AppConfig.bubbleSizeFactor,
vertical: 8 * AppConfig.bubbleSizeFactor,
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
child: Text(
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor',
@ -176,18 +176,6 @@ class SettingsStyleView extends StatelessWidget {
semanticFormatterCallback: (d) => d.toString(),
onChanged: controller.changeFontSizeFactor,
),
ListTile(
title: Text(L10n.of(context)!.bubbleSize),
trailing: Text('× ${AppConfig.bubbleSizeFactor}'),
),
Slider.adaptive(
min: 0.5,
max: 1.5,
divisions: 4,
value: AppConfig.bubbleSizeFactor,
semanticFormatterCallback: (d) => d.toString(),
onChanged: controller.changeBubbleSizeFactor,
),
],
),
),

View file

@ -444,10 +444,6 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
(value) => AppConfig.fontSizeFactor =
double.tryParse(value ?? '') ?? AppConfig.fontSizeFactor,
);
store.getItem(SettingKeys.bubbleSizeFactor).then(
(value) => AppConfig.bubbleSizeFactor =
double.tryParse(value ?? '') ?? AppConfig.bubbleSizeFactor,
);
store
.getItemBool(SettingKeys.renderHtml, AppConfig.renderHtml)
.then((value) => AppConfig.renderHtml = value);