mirror of
https://github.com/Livinglist/Hacki.git
synced 2025-05-17 22:16:10 +08:00
fix: theming. (#508)
This commit is contained in:
@ -43,7 +43,7 @@ abstract class Constants {
|
||||
'٩(˘◡˘)۶',
|
||||
'(─‿‿─)',
|
||||
'(¬‿¬)',
|
||||
].pickRandomly()!;
|
||||
].randomlyPicked!;
|
||||
|
||||
static final String sadFace = <String>[
|
||||
'ಥ_ಥ',
|
||||
@ -55,13 +55,13 @@ abstract class Constants {
|
||||
'(ㆆ_ㆆ)',
|
||||
'ʕ•́ᴥ•̀ʔっ',
|
||||
'(ㆆ_ㆆ)',
|
||||
].pickRandomly()!;
|
||||
].randomlyPicked!;
|
||||
|
||||
static final String magicWord = <String>[
|
||||
'to be over the rainbow!',
|
||||
'to infinity and beyond!',
|
||||
'to see the future.',
|
||||
].pickRandomly()!;
|
||||
].randomlyPicked!;
|
||||
|
||||
static final String errorMessage = 'Something went wrong...$sadFace';
|
||||
static final String loginErrorMessage =
|
||||
|
@ -54,8 +54,6 @@ class PreferenceState extends Equatable {
|
||||
|
||||
bool get isFaviconEnabled => _isOn<FaviconModePreference>();
|
||||
|
||||
bool get isEyeCandyEnabled => _isOn<EyeCandyModePreference>();
|
||||
|
||||
bool get isReaderEnabled => _isOn<ReaderModePreference>();
|
||||
|
||||
bool get isMarkReadStoriesEnabled => _isOn<MarkReadStoriesModePreference>();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:math';
|
||||
|
||||
extension ListExtension<T> on List<T> {
|
||||
T? pickRandomly() {
|
||||
T? get randomlyPicked {
|
||||
if (isEmpty) return null;
|
||||
final Random random = Random(DateTime.now().millisecondsSinceEpoch);
|
||||
final int luckyNumber = random.nextInt(length);
|
||||
|
@ -50,7 +50,6 @@ abstract final class Preference<T> extends Equatable with SettingsDisplayable {
|
||||
const ManualPaginationPreference(),
|
||||
const SwipeGesturePreference(),
|
||||
const HapticFeedbackPreference(),
|
||||
const EyeCandyModePreference(),
|
||||
const TrueDarkModePreference(),
|
||||
const DevMode(),
|
||||
],
|
||||
@ -316,27 +315,6 @@ final class MarkReadStoriesModePreference extends BooleanPreference {
|
||||
String get subtitle => 'grey out stories you have read.';
|
||||
}
|
||||
|
||||
final class EyeCandyModePreference extends BooleanPreference {
|
||||
const EyeCandyModePreference({bool? val})
|
||||
: super(val: val ?? _eyeCandyModeDefaultValue);
|
||||
|
||||
static const bool _eyeCandyModeDefaultValue = false;
|
||||
|
||||
@override
|
||||
EyeCandyModePreference copyWith({required bool? val}) {
|
||||
return EyeCandyModePreference(val: val);
|
||||
}
|
||||
|
||||
@override
|
||||
String get key => 'eyeCandyMode';
|
||||
|
||||
@override
|
||||
String get title => 'Eye Candy';
|
||||
|
||||
@override
|
||||
String get subtitle => 'some sort of magic.';
|
||||
}
|
||||
|
||||
final class ManualPaginationPreference extends BooleanPreference {
|
||||
const ManualPaginationPreference({bool? val})
|
||||
: super(val: val ?? _paginationModeDefaultValue);
|
||||
|
@ -33,9 +33,9 @@ class CustomFloatingActionButton extends StatelessWidget {
|
||||
CustomDescribedFeatureOverlay(
|
||||
feature: DiscoverableFeature.jumpUpButton,
|
||||
contentLocation: ContentLocation.above,
|
||||
tapTarget: const Icon(
|
||||
tapTarget: Icon(
|
||||
Icons.keyboard_arrow_up,
|
||||
color: Palette.white,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
child: InkWell(
|
||||
onLongPress: () =>
|
||||
@ -59,9 +59,9 @@ class CustomFloatingActionButton extends StatelessWidget {
|
||||
),
|
||||
CustomDescribedFeatureOverlay(
|
||||
feature: DiscoverableFeature.jumpDownButton,
|
||||
tapTarget: const Icon(
|
||||
tapTarget: Icon(
|
||||
Icons.keyboard_arrow_down,
|
||||
color: Palette.white,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
child: InkWell(
|
||||
onLongPress: () {
|
||||
|
@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:hacki/cubits/cubits.dart';
|
||||
import 'package:hacki/models/discoverable_feature.dart';
|
||||
import 'package:hacki/screens/widgets/widgets.dart';
|
||||
import 'package:hacki/styles/styles.dart';
|
||||
import 'package:hacki/utils/utils.dart';
|
||||
|
||||
class FavIconButton extends StatelessWidget {
|
||||
@ -24,7 +23,7 @@ class FavIconButton extends StatelessWidget {
|
||||
icon: CustomDescribedFeatureOverlay(
|
||||
tapTarget: Icon(
|
||||
isFav ? Icons.favorite : Icons.favorite_border,
|
||||
color: Palette.white,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
feature: DiscoverableFeature.addStoryToFavList,
|
||||
child: Icon(
|
||||
|
@ -22,9 +22,9 @@ class InThreadSearchIconButton extends StatelessWidget {
|
||||
transitionType: ContainerTransitionType.fadeThrough,
|
||||
closedBuilder: (BuildContext context, void Function() action) {
|
||||
return CustomDescribedFeatureOverlay(
|
||||
tapTarget: const Icon(
|
||||
tapTarget: Icon(
|
||||
Icons.search,
|
||||
color: Palette.white,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
feature: DiscoverableFeature.searchInThread,
|
||||
child: IconButton(
|
||||
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:hacki/config/constants.dart';
|
||||
import 'package:hacki/models/discoverable_feature.dart';
|
||||
import 'package:hacki/screens/widgets/widgets.dart';
|
||||
import 'package:hacki/styles/styles.dart';
|
||||
import 'package:hacki/utils/utils.dart';
|
||||
|
||||
class LinkIconButton extends StatelessWidget {
|
||||
@ -17,13 +16,13 @@ class LinkIconButton extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return IconButton(
|
||||
tooltip: 'Open this story in browser',
|
||||
icon: const CustomDescribedFeatureOverlay(
|
||||
icon: CustomDescribedFeatureOverlay(
|
||||
tapTarget: Icon(
|
||||
Icons.stream,
|
||||
color: Palette.white,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
feature: DiscoverableFeature.openStoryInWebView,
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.stream,
|
||||
),
|
||||
),
|
||||
|
@ -6,7 +6,6 @@ import 'package:hacki/cubits/cubits.dart';
|
||||
import 'package:hacki/extensions/context_extension.dart';
|
||||
import 'package:hacki/models/models.dart';
|
||||
import 'package:hacki/screens/widgets/widgets.dart';
|
||||
import 'package:hacki/styles/styles.dart';
|
||||
import 'package:hacki/utils/utils.dart';
|
||||
|
||||
class PinIconButton extends StatelessWidget {
|
||||
@ -31,7 +30,7 @@ class PinIconButton extends StatelessWidget {
|
||||
icon: CustomDescribedFeatureOverlay(
|
||||
tapTarget: Icon(
|
||||
pinned ? Icons.push_pin : Icons.push_pin_outlined,
|
||||
color: Palette.white,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
feature: DiscoverableFeature.pinToTop,
|
||||
child: Icon(
|
||||
|
@ -245,6 +245,8 @@ class _ReplyBoxState extends State<ReplyBox> with ItemActionMixin {
|
||||
hintStyle: TextStyle(
|
||||
color: Palette.grey,
|
||||
),
|
||||
enabledBorder: InputBorder.none,
|
||||
disabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
border: InputBorder.none,
|
||||
),
|
||||
|
@ -40,10 +40,12 @@ class LogScreen extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
...?snapshot.data?.map(Text.new),
|
||||
],
|
||||
body: Scrollbar(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
...?snapshot.data?.map(Text.new),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:adaptive_theme/adaptive_theme.dart';
|
||||
import 'package:feature_discovery/feature_discovery.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -62,6 +63,12 @@ class _SettingsState extends State<Settings> with ItemActionMixin, Loggable {
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.person,
|
||||
color: widget.authState.isLoggedIn
|
||||
? Theme.of(context).primaryColor
|
||||
: null,
|
||||
),
|
||||
title: Text(
|
||||
widget.authState.isLoggedIn ? 'Log Out' : 'Log In',
|
||||
),
|
||||
@ -392,7 +399,7 @@ class _SettingsState extends State<Settings> with ItemActionMixin, Loggable {
|
||||
),
|
||||
onTap: showClearCacheDialog,
|
||||
),
|
||||
if (preferenceState.isDevModeEnabled)
|
||||
if (preferenceState.isDevModeEnabled) ...<Widget>[
|
||||
ListTile(
|
||||
title: const Text(
|
||||
'Logs',
|
||||
@ -401,6 +408,20 @@ class _SettingsState extends State<Settings> with ItemActionMixin, Loggable {
|
||||
context.go(Paths.log.landing);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: const Text(
|
||||
'Reset Feature Discovery',
|
||||
),
|
||||
onTap: () {
|
||||
HapticFeedbackUtil.light();
|
||||
FeatureDiscovery.clearPreferences(
|
||||
context,
|
||||
DiscoverableFeature.values
|
||||
.map((DiscoverableFeature f) => f.featureId),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
ListTile(
|
||||
title: const Text('About'),
|
||||
subtitle: const Text('nothing interesting here.'),
|
||||
|
@ -75,11 +75,6 @@ class CommentTile extends StatelessWidget {
|
||||
|
||||
final Color primaryColor = Theme.of(context).colorScheme.primary;
|
||||
final Brightness brightness = Theme.of(context).brightness;
|
||||
final Color color = _getColor(
|
||||
level,
|
||||
primaryColor: primaryColor,
|
||||
brightness: brightness,
|
||||
);
|
||||
|
||||
final Widget child = DeviceGestureWrapper(
|
||||
child: Column(
|
||||
@ -307,12 +302,7 @@ class CommentTile extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
|
||||
final double commentBackgroundColorOpacity =
|
||||
Theme.of(context).canvasColor != Palette.white ? 0.03 : 0.15;
|
||||
|
||||
final Color commentColor = prefState.isEyeCandyEnabled
|
||||
? color.withValues(alpha: commentBackgroundColorOpacity)
|
||||
: Palette.transparent;
|
||||
const Color commentColor = Palette.transparent;
|
||||
final bool isMyComment = comment.deleted == false &&
|
||||
context.read<AuthBloc>().state.username == comment.by;
|
||||
|
||||
|
@ -84,10 +84,10 @@ class _CustomTabBarState extends State<CustomTabBar> {
|
||||
Tab(
|
||||
child: CustomDescribedFeatureOverlay(
|
||||
onComplete: showOnboarding,
|
||||
tapTarget: const Icon(
|
||||
tapTarget: Icon(
|
||||
Icons.person,
|
||||
size: TextDimens.pt16,
|
||||
color: Palette.white,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
feature: DiscoverableFeature.login,
|
||||
child: BlocBuilder<NotificationCubit, NotificationState>(
|
||||
|
Reference in New Issue
Block a user