mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-08-03 03:36:23 -04:00
More UI Cleanup
This commit is contained in:
parent
3b1cb53b8a
commit
68e8d7fd39
17 changed files with 281 additions and 301 deletions
|
@ -191,6 +191,12 @@ class ScaleTheme extends ThemeExtension<ScaleTheme> {
|
|||
inputDecorationTheme:
|
||||
ScaleInputDecoratorTheme(scheme, config, textTheme),
|
||||
sliderTheme: sliderTheme,
|
||||
popupMenuTheme: PopupMenuThemeData(
|
||||
color: scheme.primaryScale.subtleBackground,
|
||||
shadowColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(8 * config.borderRadiusScale))),
|
||||
extensions: <ThemeExtension<dynamic>>[scheme, config, this]);
|
||||
|
||||
return themeData;
|
||||
|
|
|
@ -38,6 +38,16 @@ const _scaleNumMult = <double>[
|
|||
1 + 1 / 1,
|
||||
];
|
||||
|
||||
const _scaleNumMultNoShrink = <double>[
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1 + 1 / 4,
|
||||
1 + 1 / 2,
|
||||
1 + 1 / 1,
|
||||
];
|
||||
|
||||
int displayScaleToIndex(double displayScale) {
|
||||
final idx = _scales.indexWhere((elem) => elem > displayScale);
|
||||
final currentScaleIdx = idx == -1 ? _scales.length - 1 : max(0, idx - 1);
|
||||
|
@ -92,6 +102,14 @@ extension DisplayScaledNum on num {
|
|||
displayScaleToIndex(prefs.themePreference.displayScale);
|
||||
return this * _scaleNumMult[currentScaleIdx];
|
||||
}
|
||||
|
||||
double scaledNoShrink(BuildContext context) {
|
||||
final prefs = context.watch<PreferencesCubit>().state.asData?.value ??
|
||||
PreferencesRepository.instance.value;
|
||||
final currentScaleIdx =
|
||||
displayScaleToIndex(prefs.themePreference.displayScale);
|
||||
return this * _scaleNumMultNoShrink[currentScaleIdx];
|
||||
}
|
||||
}
|
||||
|
||||
extension DisplayScaledEdgeInsets on EdgeInsets {
|
||||
|
|
|
@ -43,7 +43,11 @@ class StyledCheckbox extends StatelessWidget {
|
|||
await _onChanged(value);
|
||||
});
|
||||
})),
|
||||
Text(_label, style: textStyle).paddingAll(4.scaled(context)),
|
||||
Text(
|
||||
_label,
|
||||
style: textStyle,
|
||||
overflow: TextOverflow.clip,
|
||||
).paddingLTRB(4.scaled(context), 0, 0, 0).flexible(),
|
||||
]);
|
||||
|
||||
if (_decoratorLabel != null) {
|
||||
|
|
|
@ -27,7 +27,7 @@ class StyledScaffold extends StatelessWidget {
|
|||
|
||||
return GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: scaffold /*.paddingAll(enableBorder ? 32 : 0) */);
|
||||
child: scaffold);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -132,7 +132,7 @@ class StyledSlideTile extends StatelessWidget {
|
|||
softWrap: false,
|
||||
),
|
||||
subtitle: subtitle.isNotEmpty ? Text(subtitle) : null,
|
||||
contentPadding: const EdgeInsets.fromLTRB(8, 4, 8, 4)
|
||||
contentPadding: const EdgeInsets.fromLTRB(8, 2, 8, 2)
|
||||
.scaled(context),
|
||||
iconColor: scaleTileTheme.textColor,
|
||||
textColor: scaleTileTheme.textColor,
|
||||
|
|
|
@ -571,6 +571,7 @@ Container clipBorder({
|
|||
required Color borderColor,
|
||||
required Widget child,
|
||||
}) =>
|
||||
// We want to return a container here
|
||||
// ignore: avoid_unnecessary_containers, use_decorated_box
|
||||
Container(
|
||||
decoration: ShapeDecoration(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue