Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 35 additions & 25 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,25 +330,42 @@ class HackiApp extends StatelessWidget {
theme: state.isHackerNewsThemeEnabled
? HackerNewsTheme.theme
: ThemeData(
colorScheme: colorScheme,
fontFamily: state.font.name,
canvasColor: isDarkModeEnabled &&
state.isTrueDarkModeEnabled
? Palette.black
: null,
scaffoldBackgroundColor: isDarkModeEnabled &&
state.isTrueDarkModeEnabled
? Palette.black
: null,
appBarTheme: AppBarTheme(
foregroundColor: colorScheme.onSurface,
iconTheme: IconThemeData(
color: colorScheme.onSurface,
),
),
bottomSheetTheme: BottomSheetThemeData(
modalElevation: Dimens.pt8,
clipBehavior: Clip.hardEdge,
shadowColor: Palette.black,
backgroundColor: isDarkModeEnabled &&
state.isTrueDarkModeEnabled
? Palette.black
: null,
),
canvasColor: isDarkModeEnabled &&
state.isTrueDarkModeEnabled
? Palette.black
: null,
colorScheme: colorScheme,
dividerTheme: DividerThemeData(
color: Palette.grey.withValues(alpha: 0.2),
),
elevatedButtonTheme:
const ElevatedButtonThemeData(
style: ButtonStyle(enableFeedback: false),
),
floatingActionButtonTheme:
const FloatingActionButtonThemeData(
enableFeedback: false,
),
fontFamily: state.font.name,
scaffoldBackgroundColor: isDarkModeEnabled &&
state.isTrueDarkModeEnabled
? Palette.black
: null,
switchTheme: SwitchThemeData(
trackColor: WidgetStateProperty.resolveWith(
(Set<WidgetState> states) {
Expand All @@ -365,21 +382,13 @@ class HackiApp extends StatelessWidget {
),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
enableFeedback: false,
foregroundColor:
WidgetStateProperty.resolveWith(
(_) => colorScheme.primary,
),
),
),
bottomSheetTheme: BottomSheetThemeData(
modalElevation: 8,
clipBehavior: Clip.hardEdge,
shadowColor: Palette.black,
backgroundColor: isDarkModeEnabled &&
state.isTrueDarkModeEnabled
? Palette.black
: null,
),
inputDecorationTheme: InputDecorationTheme(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
Expand All @@ -402,21 +411,22 @@ class HackiApp extends StatelessWidget {
),
),
),
sliderTheme: SliderThemeData(
inactiveTrackColor: colorScheme.primary
.withValues(alpha: 0.5),
activeTrackColor: colorScheme.primary,
thumbColor: colorScheme.primary,
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: ButtonStyle(
enableFeedback: false,
side: WidgetStateBorderSide.resolveWith(
(_) => const BorderSide(
color: Palette.grey,
),
),
),
),
sliderTheme: SliderThemeData(
inactiveTrackColor: colorScheme.primary
.withValues(alpha: 0.5),
activeTrackColor: colorScheme.primary,
thumbColor: colorScheme.primary,
),
),
routerConfig: router,
builder: state.isDevModeEnabled
Expand Down
9 changes: 7 additions & 2 deletions lib/screens/item/widgets/custom_floating_action_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ class FloatingSkipButtons extends StatelessWidget {
color: Theme.of(context).colorScheme.onPrimary,
),
child: InkWell(
onLongPress: () =>
context.read<CommentsCubit>().scrollTo(index: 0),
enableFeedback: false,
onLongPress: () {
HapticFeedbackUtils.light();
context.read<CommentsCubit>().scrollTo(index: 0);
},
child: FloatingActionButton(
enableFeedback: false,
backgroundColor: Theme.of(context)
Expand Down Expand Up @@ -70,7 +73,9 @@ class FloatingSkipButtons extends StatelessWidget {
color: Theme.of(context).colorScheme.onPrimary,
),
child: InkWell(
enableFeedback: false,
onLongPress: () {
HapticFeedbackUtils.light();
final CommentsCubit cubit = context.read<CommentsCubit>();
cubit.scrollTo(index: cubit.state.comments.length - 1);
},
Expand Down
134 changes: 68 additions & 66 deletions lib/screens/item/widgets/item_screen_background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,26 @@ class ItemScreenBackground extends StatefulWidget {

class _ItemScreenBackgroundState extends State<ItemScreenBackground> {
int _shineIndex = 0;
bool _isVisible = false;
bool _overrideCommentsStatus = false;

Timer? _visibilityTimer;
Timer? _animationTimer;
Timer? _overrideTimer;

@override
void initState() {
super.initState();

_visibilityTimer = Timer(AppDurations.oneSecond, () {
if (mounted) {
setState(() => _isVisible = true);
}
});
_overrideTimer = Timer(AppDurations.fiveSeconds, () {
if (mounted) {
setState(() => _overrideCommentsStatus = true);
}
_overrideTimer?.cancel();
});
}

@override
void dispose() {
_visibilityTimer?.cancel();
_animationTimer?.cancel();
_overrideTimer?.cancel();
super.dispose();
}
Expand All @@ -68,8 +63,8 @@ class _ItemScreenBackgroundState extends State<ItemScreenBackground> {
previous.status != current.status,
listener: (BuildContext context, CommentsState state) {
if (state.status == CommentsStatus.allLoaded && isEyeCandyEnabled) {
_visibilityTimer?.cancel();
_visibilityTimer =
_animationTimer?.cancel();
_animationTimer =
Timer.periodic(const Duration(milliseconds: 1200), (_) {
setState(() {
_shineIndex = (_shineIndex + 1) % (state.maxLevel + 1);
Expand All @@ -81,12 +76,14 @@ class _ItemScreenBackgroundState extends State<ItemScreenBackground> {
previous.maxLevel != current.maxLevel ||
previous.status != current.status,
builder: (BuildContext context, CommentsState state) {
if (!_isVisible || state.comments.isEmpty) {
return const SizedBox.shrink();
} else if (!_overrideCommentsStatus &&
state.status == CommentsStatus.inProgress) {
return FadeIn(
child: Stack(
return FadeIn(
child: AnimatedCrossFade(
duration: AppDurations.ms400,
crossFadeState: !_overrideCommentsStatus &&
state.status == CommentsStatus.inProgress
? CrossFadeState.showFirst
: CrossFadeState.showSecond,
firstChild: Stack(
children: <Widget>[
Positioned(
left: Dimens.zero,
Expand All @@ -96,75 +93,80 @@ class _ItemScreenBackgroundState extends State<ItemScreenBackground> {
quarterTurns: 1,
child: LinearProgressIndicator(
minHeight: widget.indentLineWidth,
color: Theme.of(context).colorScheme.primaryContainer,
backgroundColor: Theme.of(context)
.colorScheme
.primaryContainer
.withValues(alpha: 0.2),
),
),
),
],
),
);
}
return FadeIn(
child: Stack(
children: <Widget>[
if (widget.shouldShowRootLevelLine)
Padding(
padding: EdgeInsets.zero,
child: SizedBox(
height: MediaQuery.of(context).size.height,
width: widget.indentLineWidth,
child: isEyeCandyEnabled
? AnimatedIndentLine(
color:
Theme.of(context).colorScheme.primaryContainer,
width: widget.indentLineWidth,
isShining: _shineIndex == 0,
)
: Container(
width: widget.indentLineWidth,
height: MediaQuery.of(context).size.height,
color:
Theme.of(context).colorScheme.primaryContainer,
),
),
),
if (state.maxLevel > 0)
for (final int i in 1.to(
state.maxLevel,
))
secondChild: Stack(
children: <Widget>[
if (widget.shouldShowRootLevelLine)
Padding(
padding: EdgeInsets.only(
left: widget.shouldShowRootLevelLine
? widget.indentPadding * i
: widget.indentPadding * i - widget.indentLineWidth,
),
padding: EdgeInsets.zero,
child: SizedBox(
height: MediaQuery.of(context).size.height,
width: widget.indentLineWidth,
child: isEyeCandyEnabled
? AnimatedIndentLine(
color: ColorUtils.getRainbowColor(
i,
Theme.of(context).canvasColor,
).$1,
color: Theme.of(context)
.colorScheme
.primaryContainer,
width: widget.indentLineWidth,
isShining: _shineIndex == i,
isShining: _shineIndex == 0,
)
: Container(
width: widget.indentLineWidth,
height: MediaQuery.of(context).size.height,
color: ColorUtils.getRainbowColor(
i,
Theme.of(context).canvasColor,
).$1.withValues(
alpha: Theme.of(context).brightness ==
Brightness.dark
? 0.6
: 1,
),
color: Theme.of(context)
.colorScheme
.primaryContainer,
),
),
),
],
if (state.maxLevel > 0)
for (final int i in 1.to(
state.maxLevel,
))
Padding(
padding: EdgeInsets.only(
left: widget.shouldShowRootLevelLine
? widget.indentPadding * i
: widget.indentPadding * i - widget.indentLineWidth,
),
child: SizedBox(
height: MediaQuery.of(context).size.height,
width: widget.indentLineWidth,
child: isEyeCandyEnabled
? AnimatedIndentLine(
color: ColorUtils.getRainbowColor(
i,
Theme.of(context).canvasColor,
).$1,
width: widget.indentLineWidth,
isShining: _shineIndex == i,
)
: Container(
width: widget.indentLineWidth,
height: MediaQuery.of(context).size.height,
color: ColorUtils.getRainbowColor(
i,
Theme.of(context).canvasColor,
).$1.withValues(
alpha: Theme.of(context).brightness ==
Brightness.dark
? 0.6
: 1,
),
),
),
),
],
),
),
);
},
Expand Down
1 change: 1 addition & 0 deletions lib/screens/item/widgets/main_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ class _ParentItemSection extends StatelessWidget {
children: <Widget>[
if (item is Story)
InkWell(
enableFeedback: false,
onTap: () => LinkUtils.launch(
item.url,
context,
Expand Down
1 change: 1 addition & 0 deletions lib/screens/widgets/custom_linkify/custom_linkify.dart
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ TextSpan buildTextSpan(
} else {
return WidgetSpan(
child: InkWell(
enableFeedback: false,
onLongPress: () {
final String url = element.url;
if (url.isNotEmpty) {
Expand Down
1 change: 1 addition & 0 deletions lib/screens/widgets/items_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class ItemsListView<T extends Item> extends StatelessWidget {
if (shouldUseMinimalTileForStory)
FadeIn(
child: InkWell(
enableFeedback: false,
onTap: () => onTap(e),

/// If swipe gesture is enabled on home screen, use
Expand Down
2 changes: 1 addition & 1 deletion lib/styles/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:hacki/models/font.dart';
import 'package:hacki/styles/dimens.dart';

extension ThemeDataExtension on ThemeData {
Color get readGrey => colorScheme.onSurface.withValues(alpha: 0.6);
Color get readGrey => hintColor;

Color get metadataColor => colorScheme.onSurface.withValues(alpha: 0.8);
}
Expand Down