refactor: Remove bubble size slider

pull/485/head
Krille 2 years ago
parent d6b48091c4
commit 6bd518fa36
No known key found for this signature in database

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

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

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

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

@ -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 @override
Widget build(BuildContext context) => SettingsStyleView(this); Widget build(BuildContext context) => SettingsStyleView(this);
} }

@ -149,9 +149,9 @@ class SettingsStyleView extends StatelessWidget {
color: Theme.of(context).colorScheme.primaryContainer, color: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(AppConfig.borderRadius), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
child: Padding( child: Padding(
padding: EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 16 * AppConfig.bubbleSizeFactor, horizontal: 16,
vertical: 8 * AppConfig.bubbleSizeFactor, vertical: 8,
), ),
child: Text( child: Text(
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor', '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(), semanticFormatterCallback: (d) => d.toString(),
onChanged: controller.changeFontSizeFactor, 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,
),
], ],
), ),
), ),

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

Loading…
Cancel
Save