Merge pull request 'Fix up a few fonts. Add more scaling options' (#702) from search into trunk
continuous-integration/drone/push Build was killed Details

Reviewed-on: #702
Reviewed-by: Dan Ballard <dan@openprivacy.ca>
This commit is contained in:
Sarah Jamie Lewis 2023-08-02 19:52:50 +00:00
commit 70914c7a87
12 changed files with 38 additions and 31 deletions

View File

@ -20,7 +20,7 @@ const mode_light = "light";
const mode_dark = "dark";
final TextStyle defaultSmallTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.normal, fontSize: 10);
final TextStyle defaultMessageTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.normal, fontSize: 12);
final TextStyle defaultMessageTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.w400, fontSize: 13);
final TextStyle defaultFormLabelTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.bold, fontSize: 20);
final TextStyle defaultTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.w500, fontSize: 12);
final TextStyle defaultTextButtonStyle = defaultTextStyle.copyWith(fontWeight: FontWeight.bold);

View File

@ -20,6 +20,7 @@ import '../config.dart';
import '../main.dart';
import '../models/message.dart';
import '../settings.dart';
import '../themes/opaque.dart';
import 'addcontactview.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:qr_flutter/qr_flutter.dart';
@ -183,21 +184,15 @@ class _ContactsViewState extends State<ContactsView> {
itemBuilder: (BuildContext context) => <PopupMenuEntry<ProfileStatusMenu>>[
PopupMenuItem<ProfileStatusMenu>(
value: ProfileStatusMenu.available,
child: Text(
AppLocalizations.of(context)!.availabilityStatusAvailable!,
),
child: Text(AppLocalizations.of(context)!.availabilityStatusAvailable!, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)),
),
PopupMenuItem<ProfileStatusMenu>(
value: ProfileStatusMenu.away,
child: Text(
AppLocalizations.of(context)!.availabilityStatusAway!,
),
child: Text(AppLocalizations.of(context)!.availabilityStatusAway!, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)),
),
PopupMenuItem<ProfileStatusMenu>(
value: ProfileStatusMenu.busy,
child: Text(
AppLocalizations.of(context)!.availabilityStatusBusy!,
),
child: Text(AppLocalizations.of(context)!.availabilityStatusBusy!, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)),
),
],
),
@ -256,11 +251,11 @@ class _ContactsViewState extends State<ContactsView> {
itemBuilder: (BuildContext context) => <PopupMenuEntry<ShareMenu>>[
PopupMenuItem<ShareMenu>(
value: ShareMenu.copyCode,
child: Text(AppLocalizations.of(context)!.copyAddress),
child: Text(AppLocalizations.of(context)!.copyAddress, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)),
),
PopupMenuItem<ShareMenu>(
value: ShareMenu.qrcode,
child: Text(AppLocalizations.of(context)!.shareMenuQRCode),
child: Text(AppLocalizations.of(context)!.shareMenuQRCode, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)),
),
],
));

View File

@ -37,7 +37,7 @@ class _FileSharingViewState extends State<FileSharingView> {
future: Provider.of<FlwtchState>(context, listen: false).cwtch.GetSharedFiles(profileHandle, Provider.of<ContactInfoState>(context).identifier),
builder: (context, snapshot) {
if (snapshot.hasData) {
List<dynamic> sharedFiles = jsonDecode(snapshot.data as String);
List<dynamic> sharedFiles = jsonDecode(snapshot.data as String) ?? List<dynamic>.empty();
sharedFiles.sort((a, b) {
return a["DateShared"].toString().compareTo(b["DateShared"].toString());
});

View File

@ -230,7 +230,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
EnvironmentConfig.debugLog("Font Scaling: $value");
},
min: 0.5,
divisions: 6,
divisions: 12,
max: 2.0,
activeColor: settings.current().defaultButtonColor,
thumbColor: settings.current().mainTextColor,
@ -467,6 +467,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
testKey: Key("DownloadFolderPicker"),
label: AppLocalizations.of(context)!.settingDownloadFolder,
initialValue: settings.downloadPath,
textStyle: settings.scaleFonts(defaultDropDownMenuItemTextStyle),
description: AppLocalizations.of(context)!.fileSharingSettingsDownloadFolderDescription,
tooltip: AppLocalizations.of(context)!.fileSharingSettingsDownloadFolderTooltip,
onSave: (newVal) {

View File

@ -131,7 +131,7 @@ class _GroupSettingsViewState extends State<GroupSettingsView> {
items: ConversationNotificationPolicy.values.map<DropdownMenuItem<ConversationNotificationPolicy>>((ConversationNotificationPolicy value) {
return DropdownMenuItem<ConversationNotificationPolicy>(
value: value,
child: Text(value.toName(context)),
child: Text(value.toName(context), style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)),
);
}).toList(),
onChanged: (ConversationNotificationPolicy? newVal) {

View File

@ -14,6 +14,7 @@ import 'package:cwtch/models/message_draft.dart';
import 'package:cwtch/models/messagecache.dart';
import 'package:cwtch/models/messages/quotedmessage.dart';
import 'package:cwtch/models/profile.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/third_party/linkify/flutter_linkify.dart';
import 'package:cwtch/widgets/malformedbubble.dart';
import 'package:cwtch/widgets/messageloadingbubble.dart';
@ -619,11 +620,9 @@ class _MessageViewState extends State<MessageView> {
maxLengthEnforcement: MaxLengthEnforcement.enforced,
maxLines: 3,
onFieldSubmitted: _sendMessage,
style: TextStyle(
fontFamily: "Inter",
fontSize: 12.0 * Provider.of<Settings>(context).fontScaling,
fontWeight: FontWeight.w300,
),
style: Provider.of<Settings>(context).scaleFonts(defaultMessageTextStyle).copyWith(
fontWeight: FontWeight.w500,
),
enabled: true, // always allow editing...
onChanged: (String x) {
@ -633,7 +632,8 @@ class _MessageViewState extends State<MessageView> {
},
decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.placeholderEnterMessage,
hintStyle: TextStyle(fontFamily: "Inter", fontSize: 10.0 * Provider.of<Settings>(context).fontScaling, color: Provider.of<Settings>(context).theme.sendHintTextColor),
hintStyle:
Provider.of<Settings>(context).scaleFonts(defaultMessageTextStyle).copyWith(color: Provider.of<Settings>(context).theme.sendHintTextColor, fontWeight: FontWeight.bold),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
enabled: true,

View File

@ -14,6 +14,7 @@ import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../main.dart';
import '../themes/opaque.dart';
/// Peer Settings View Provides way to Configure .
class PeerSettingsView extends StatefulWidget {
@ -242,7 +243,7 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
items: [AppLocalizations.of(context)!.savePeerHistory, AppLocalizations.of(context)!.dontSavePeerHistory].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
child: Text(value, style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)),
);
}).toList())),
ListTile(
@ -254,7 +255,7 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
items: ConversationNotificationPolicy.values.map<DropdownMenuItem<ConversationNotificationPolicy>>((ConversationNotificationPolicy value) {
return DropdownMenuItem<ConversationNotificationPolicy>(
value: value,
child: Text(value.toName(context)),
child: Text(value.toName(context), style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)),
);
}).toList(),
onChanged: (ConversationNotificationPolicy? newVal) {

View File

@ -14,6 +14,7 @@ class CwtchButtonTextField extends StatefulWidget {
this.labelText,
this.testKey,
this.onChanged,
this.textStyle,
});
final TextEditingController controller;
final Function()? onPressed;
@ -22,6 +23,7 @@ class CwtchButtonTextField extends StatefulWidget {
final String tooltip;
final bool readonly;
final Key? testKey;
final TextStyle? textStyle;
String? labelText;
@override
@ -56,7 +58,7 @@ class _CwtchButtonTextFieldState extends State<CwtchButtonTextField> {
enableIMEPersonalizedLearning: false,
onChanged: widget.onChanged,
maxLines: 1,
style: TextStyle(overflow: TextOverflow.clip),
style: widget.textStyle == null ? TextStyle(overflow: TextOverflow.clip) : widget.textStyle,
decoration: InputDecoration(
labelText: widget.labelText,
labelStyle: TextStyle(color: theme.current().mainTextColor, backgroundColor: theme.current().textfieldBackgroundColor),

View File

@ -14,7 +14,8 @@ class CwtchFolderPicker extends StatefulWidget {
final String description;
final Function(String)? onSave;
final Key? testKey;
const CwtchFolderPicker({Key? key, this.testKey, this.label = "", this.tooltip = "", this.initialValue = "", this.onSave, this.description = ""}) : super(key: key);
final TextStyle? textStyle;
const CwtchFolderPicker({Key? key, this.testKey, this.textStyle, this.label = "", this.tooltip = "", this.initialValue = "", this.onSave, this.description = ""}) : super(key: key);
@override
_CwtchFolderPickerState createState() => _CwtchFolderPickerState();
@ -40,6 +41,7 @@ class _CwtchFolderPickerState extends State<CwtchFolderPicker> {
child: CwtchButtonTextField(
testKey: widget.testKey,
controller: ctrlrVal,
textStyle: widget.textStyle,
readonly: Platform.isAndroid,
onPressed: Provider.of<AppState>(context).disableFilePicker
? null

View File

@ -3,6 +3,7 @@ import 'package:cwtch/models/profile.dart';
import 'package:cwtch/models/profileservers.dart';
import 'package:cwtch/models/remoteserver.dart';
import 'package:cwtch/models/servers.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/views/addeditservers.dart';
import 'package:cwtch/views/remoteserverview.dart';
import 'package:cwtch/widgets/profileimage.dart';
@ -50,7 +51,9 @@ class _RemoteServerRowState extends State<RemoteServerRow> {
Text(
description,
semanticsLabel: description,
style: TextStyle(fontFamily: "Inter", fontSize: 10.0 * Provider.of<Settings>(context).fontScaling, fontWeight: FontWeight.bold)
style: Provider.of<Settings>(context)
.scaleFonts(defaultFormLabelTextStyle)
.copyWith(fontWeight: FontWeight.bold)
.apply(color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
softWrap: true,
overflow: TextOverflow.ellipsis,

View File

@ -1,7 +1,6 @@
import 'package:cwtch/main.dart';
import 'package:cwtch/models/servers.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/views/addeditservers.dart';
import 'package:cwtch/widgets/profileimage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
@ -43,7 +42,8 @@ class _ServerRowState extends State<ServerRow> {
Text(
server.description,
semanticsLabel: server.description,
style: TextStyle(fontFamily: "Inter", fontSize: 10.0 * Provider.of<Settings>(context).fontScaling)
style: Provider.of<Settings>(context)
.scaleFonts(defaultFormLabelTextStyle)
.apply(color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
softWrap: true,
overflow: TextOverflow.ellipsis,
@ -55,7 +55,9 @@ class _ServerRowState extends State<ServerRow> {
server.onion,
softWrap: true,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
style: Provider.of<Settings>(context)
.scaleFonts(defaultFormLabelTextStyle)
.copyWith(color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
)))
],
)),

View File

@ -1,3 +1,4 @@
import 'package:cwtch/themes/opaque.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -64,7 +65,7 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
scrollController: _scrollController,
enableIMEPersonalizedLearning: false,
focusNode: _focusNode,
style: TextStyle(overflow: TextOverflow.clip),
style: Provider.of<Settings>(context).scaleFonts(defaultTextStyle).copyWith(overflow: TextOverflow.clip),
decoration: InputDecoration(
errorMaxLines: 2,
hintText: widget.hintText,