Compare commits

...

2 Commits

Author SHA1 Message Date
cff4a3c5c4 v0.2.22 (#59)
* bumped version.

* cleaned up code.

* bumped version.

* fixed lint.

* updated android config.

* prevent backup of secure storage.

* small fix.

* cleaned up code.

* cleaned up.

* small fix
2022-06-22 23:44:49 -07:00
502faaf188 corrected spelling. 2022-06-22 10:28:27 -07:00
42 changed files with 743 additions and 546 deletions

View File

@ -33,7 +33,7 @@ if (keystorePropertiesFile.exists()) {
android {
compileSdkVersion 31
compileSdkVersion 32
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@ -49,10 +49,9 @@ android {
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.jiaqifeng.hacki"
minSdkVersion 26
targetSdkVersion 30
targetSdkVersion 32
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
@ -78,5 +77,5 @@ flutter {
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

View File

@ -16,8 +16,10 @@
</queries>
<application
android:label="hacki"
android:label="Hacki"
android:icon="@mipmap/ic_launcher"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_rules"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
@ -25,6 +27,7 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:exported="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<exclude domain="sharedpref" path="FlutterSecureStorage"/>
</full-backup-content>

View File

@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.1'
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

View File

@ -0,0 +1,2 @@
- Offline mode now includes web pages.
- You can now sort comments in story screen.

View File

@ -568,7 +568,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = QMWX3X2NF7;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@ -577,7 +577,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.2.21;
MARKETING_VERSION = 0.2.22;
PRODUCT_BUNDLE_IDENTIFIER = com.jiaqi.hacki;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -705,7 +705,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = QMWX3X2NF7;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@ -714,7 +714,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.2.21;
MARKETING_VERSION = 0.2.22;
PRODUCT_BUNDLE_IDENTIFIER = com.jiaqi.hacki;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -736,7 +736,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = QMWX3X2NF7;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@ -745,7 +745,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.2.21;
MARKETING_VERSION = 0.2.22;
PRODUCT_BUNDLE_IDENTIFIER = com.jiaqi.hacki;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -75,16 +75,7 @@ class CommentsCubit extends Cubit<CommentsState> {
final Item updatedItem = state.offlineReading
? item
: await _storiesRepository.fetchItemBy(id: item.id) ?? item;
final List<int> kids = () {
switch (state.order) {
case CommentsOrder.natural:
return updatedItem.kids;
case CommentsOrder.newestFirst:
return updatedItem.kids.sorted((int a, int b) => b.compareTo(a));
case CommentsOrder.oldestFirst:
return updatedItem.kids.sorted((int a, int b) => a.compareTo(b));
}
}();
final List<int> kids = sortKids(updatedItem.kids);
emit(state.copyWith(item: updatedItem));
@ -127,16 +118,7 @@ class CommentsCubit extends Cubit<CommentsState> {
final Item item = state.item;
final Item updatedItem =
await _storiesRepository.fetchItemBy(id: item.id) ?? item;
final List<int> kids = () {
switch (state.order) {
case CommentsOrder.natural:
return updatedItem.kids;
case CommentsOrder.newestFirst:
return updatedItem.kids.sorted((int a, int b) => b.compareTo(a));
case CommentsOrder.oldestFirst:
return updatedItem.kids.sorted((int a, int b) => a.compareTo(b));
}
}();
final List<int> kids = sortKids(updatedItem.kids);
_streamSubscription = _storiesRepository
.fetchCommentsStream(ids: kids)
@ -200,6 +182,17 @@ class CommentsCubit extends Cubit<CommentsState> {
init();
}
List<int> sortKids(List<int> kids) {
switch (state.order) {
case CommentsOrder.natural:
return kids;
case CommentsOrder.newestFirst:
return kids.sorted((int a, int b) => b.compareTo(a));
case CommentsOrder.oldestFirst:
return kids.sorted((int a, int b) => a.compareTo(b));
}
}
void _onDone() {
_streamSubscription?.cancel();
_streamSubscription = null;

View File

@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/main.dart';
import 'package:hacki/screens/screens.dart' show ItemScreen, ItemScreenArgs;
import 'package:hacki/styles/styles.dart';
extension StateExtension on State {
void showSnackBar({
@ -12,7 +13,7 @@ extension StateExtension on State {
}) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
backgroundColor: Colors.deepOrange,
backgroundColor: Palette.deepOrange,
content: Text(content),
action: action != null && label != null
? SnackBarAction(

View File

@ -15,6 +15,7 @@ import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/repositories/repositories.dart' show PreferenceRepository;
import 'package:hacki/screens/screens.dart';
import 'package:hacki/services/fetcher.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
import 'package:rxdart/rxdart.dart' show BehaviorSubject;
@ -182,19 +183,19 @@ class HackiApp extends StatelessWidget {
],
child: AdaptiveTheme(
light: ThemeData(
primarySwatch: Colors.orange,
primarySwatch: Palette.orange,
),
dark: ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.orange,
canvasColor: trueDarkMode ? Colors.black : null,
primarySwatch: Palette.orange,
canvasColor: trueDarkMode ? Palette.black : null,
),
initial: savedThemeMode ?? AdaptiveThemeMode.system,
builder: (ThemeData theme, ThemeData darkTheme) {
final ThemeData trueDarkTheme = ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.orange,
canvasColor: Colors.black,
primarySwatch: Palette.orange,
canvasColor: Palette.black,
);
return FutureBuilder<AdaptiveThemeMode?>(
future: AdaptiveTheme.getThemeMode(),

View File

@ -24,6 +24,7 @@ import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/screens/screens.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/services/services.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:responsive_builder/responsive_builder.dart';
@ -171,8 +172,8 @@ class _HomeScreenState extends State<HomeScreen>
HapticFeedback.lightImpact();
context.read<PinCubit>().unpinStory(story);
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
backgroundColor: Palette.red,
foregroundColor: Palette.white,
icon: preferenceState.showComplexStoryTile
? Icons.close
: null,
@ -181,7 +182,7 @@ class _HomeScreenState extends State<HomeScreen>
],
),
child: Container(
color: Colors.orangeAccent.withOpacity(0.2),
color: Palette.orangeAccent.withOpacity(0.2),
child: StoryTile(
key: ValueKey<String>('${story.id}-PinnedStoryTile'),
story: story,
@ -194,9 +195,9 @@ class _HomeScreenState extends State<HomeScreen>
),
if (state.pinnedStories.isNotEmpty)
const Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
padding: EdgeInsets.symmetric(horizontal: Dimens.pt12),
child: Divider(
color: Colors.orangeAccent,
color: Palette.orangeAccent,
),
),
],
@ -209,27 +210,32 @@ class _HomeScreenState extends State<HomeScreen>
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: PreferredSize(
preferredSize: const Size(0, 40),
preferredSize: const Size(
Dimens.zero,
Dimens.pt40,
),
child: Column(
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).padding.top - 8,
height: MediaQuery.of(context).padding.top - Dimens.pt8,
),
Theme(
data: ThemeData(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
highlightColor: Palette.transparent,
splashColor: Palette.transparent,
primaryColor: Theme.of(context).primaryColor,
),
child: TabBar(
isScrollable: true,
controller: tabController,
indicatorColor: Colors.orange,
indicatorColor: Palette.orange,
indicator: CircleTabIndicator(
color: Colors.orange,
radius: 2,
color: Palette.orange,
radius: Dimens.pt2,
),
indicatorPadding: const EdgeInsets.only(
bottom: Dimens.pt8,
),
indicatorPadding: const EdgeInsets.only(bottom: 8),
onTap: (_) {
HapticFeedback.selectionClick();
},
@ -242,10 +248,12 @@ class _HomeScreenState extends State<HomeScreen>
child: Text(
StoriesBloc.types.elementAt(i).label,
style: TextStyle(
fontSize: currentIndex == i ? 14 : 10,
fontSize: currentIndex == i
? TextDimens.pt14
: TextDimens.pt10,
color: currentIndex == i
? Colors.orange
: Colors.grey,
? Palette.orange
: Palette.grey,
),
),
),
@ -263,8 +271,8 @@ class _HomeScreenState extends State<HomeScreen>
targetColor: Theme.of(context).primaryColor,
tapTarget: const Icon(
Icons.person,
size: 16,
color: Colors.white,
size: TextDimens.pt16,
color: Palette.white,
),
featureId: Constants.featureLogIn,
title: const Text('Log in for more'),
@ -274,7 +282,7 @@ class _HomeScreenState extends State<HomeScreen>
'posted in the past, and get in-app '
'notification when there is new reply to '
'your comments or stories.',
style: TextStyle(fontSize: 16),
style: TextStyle(fontSize: TextDimens.pt16),
),
child: BlocBuilder<NotificationCubit,
NotificationState>(
@ -292,19 +300,21 @@ class _HomeScreenState extends State<HomeScreen>
showBadge: state.unreadCommentsIds.isNotEmpty,
borderRadius: BorderRadius.circular(100),
badgeContent: Container(
height: 3,
width: 3,
height: Dimens.pt3,
width: Dimens.pt3,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
color: Palette.white,
),
),
child: Icon(
Icons.person,
size: currentIndex == 5 ? 16 : 12,
size: currentIndex == 5
? TextDimens.pt16
: TextDimens.pt12,
color: currentIndex == 5
? Colors.orange
: Colors.grey,
? Palette.orange
: Palette.grey,
),
);
},
@ -506,10 +516,10 @@ class _MobileHomeScreen extends StatelessWidget {
Positioned.fill(child: homeScreen),
if (!context.read<ReminderCubit>().state.hasShown)
const Positioned(
left: 24,
right: 24,
bottom: 36,
height: 40,
left: Dimens.pt24,
right: Dimens.pt24,
bottom: Dimens.pt36,
height: Dimens.pt40,
child: CountdownReminder(),
),
],
@ -533,7 +543,7 @@ class _TabletHomeScreen extends StatelessWidget {
double homeScreenWidth = 428;
if (sizeInfo.screenSize.width < homeScreenWidth * 2) {
homeScreenWidth = 345.0;
homeScreenWidth = 345;
}
return BlocBuilder<SplitViewCubit, SplitViewState>(
@ -543,26 +553,26 @@ class _TabletHomeScreen extends StatelessWidget {
return Stack(
children: <Widget>[
AnimatedPositioned(
left: 0,
top: 0,
bottom: 0,
width: state.expanded ? 0 : homeScreenWidth,
left: Dimens.zero,
top: Dimens.zero,
bottom: Dimens.zero,
width: state.expanded ? Dimens.zero : homeScreenWidth,
duration: const Duration(milliseconds: 300),
curve: Curves.elasticOut,
child: homeScreen,
),
Positioned(
left: 24,
bottom: 36,
height: 40,
width: homeScreenWidth - 24,
left: Dimens.pt24,
bottom: Dimens.pt36,
height: Dimens.pt40,
width: homeScreenWidth - Dimens.pt24,
child: const CountdownReminder(),
),
AnimatedPositioned(
right: 0,
top: 0,
bottom: 0,
left: state.expanded ? 0 : homeScreenWidth,
right: Dimens.zero,
top: Dimens.zero,
bottom: Dimens.zero,
left: state.expanded ? Dimens.zero : homeScreenWidth,
duration: const Duration(milliseconds: 300),
curve: Curves.elasticOut,
child: const _TabletStoryView(),

View File

@ -19,6 +19,7 @@ import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/screens/item/widgets/widgets.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/services/services.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:responsive_builder/responsive_builder.dart';
@ -239,13 +240,15 @@ class _ItemScreenState extends State<ItemScreen> {
enablePullUp: !state.onlyShowTargetComment,
enablePullDown: !state.onlyShowTargetComment,
header: WaterDropMaterialHeader(
backgroundColor: Colors.orange,
backgroundColor: Palette.orange,
offset: topPadding,
),
footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus? mode) {
Widget body;
const double height = 55;
late final Widget body;
if (mode == LoadStatus.idle) {
body = const Text('');
} else if (mode == LoadStatus.loading) {
@ -262,7 +265,7 @@ class _ItemScreenState extends State<ItemScreen> {
body = const Text('');
}
return SizedBox(
height: 55,
height: height,
child: Center(child: body),
);
},
@ -276,7 +279,7 @@ class _ItemScreenState extends State<ItemScreen> {
} else {
context.read<CommentsCubit>().refresh();
if (widget.item.isPoll) {
if (state.item.isPoll) {
context.read<PollCubit>().refresh();
}
}
@ -290,7 +293,7 @@ class _ItemScreenState extends State<ItemScreen> {
),
if (!widget.splitViewEnabled)
const Padding(
padding: EdgeInsets.only(bottom: 6),
padding: EdgeInsets.only(bottom: Dimens.pt6),
child: OfflineBanner(),
),
Slidable(
@ -301,23 +304,27 @@ class _ItemScreenState extends State<ItemScreen> {
onPressed: (_) {
HapticFeedback.lightImpact();
if (widget.item !=
context.read<EditCubit>().state.replyingTo) {
if (state.item.id !=
context
.read<EditCubit>()
.state
.replyingTo
?.id) {
commentEditingController.clear();
}
context
.read<EditCubit>()
.onReplyTapped(widget.item);
.onReplyTapped(state.item);
focusNode.requestFocus();
},
backgroundColor: Colors.orange,
foregroundColor: Colors.white,
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.message,
),
SlidableAction(
onPressed: (_) => onMoreTapped(widget.item),
backgroundColor: Colors.orange,
foregroundColor: Colors.white,
onPressed: (_) => onMoreTapped(state.item),
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.more_horiz,
),
],
@ -326,22 +333,22 @@ class _ItemScreenState extends State<ItemScreen> {
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
left: 6,
right: 6,
left: Dimens.pt6,
right: Dimens.pt6,
),
child: Row(
children: <Widget>[
Text(
state.item.by,
style: const TextStyle(
color: Colors.orange,
color: Palette.orange,
),
),
const Spacer(),
Text(
state.item.postedDate,
style: const TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
],
@ -362,10 +369,10 @@ class _ItemScreenState extends State<ItemScreen> {
),
child: Padding(
padding: const EdgeInsets.only(
left: 6,
right: 6,
bottom: 12,
top: 12,
left: Dimens.pt6,
right: Dimens.pt6,
bottom: Dimens.pt12,
top: Dimens.pt12,
),
child: Text(
state.item.title,
@ -373,7 +380,7 @@ class _ItemScreenState extends State<ItemScreen> {
style: TextStyle(
fontWeight: FontWeight.bold,
color: state.item.url.isNotEmpty
? Colors.orange
? Palette.orange
: null,
),
),
@ -381,25 +388,25 @@ class _ItemScreenState extends State<ItemScreen> {
)
else
const SizedBox(
height: 6,
height: Dimens.pt6,
),
if (state.item.text.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
horizontal: Dimens.pt10,
),
child: SelectableLinkify(
text: widget.item.text,
text: state.item.text,
style: TextStyle(
fontSize:
MediaQuery.of(context).textScaleFactor *
15,
TextDimens.pt15,
),
linkStyle: TextStyle(
fontSize:
MediaQuery.of(context).textScaleFactor *
15,
color: Colors.orange,
TextDimens.pt15,
color: Palette.orange,
),
onOpen: (LinkableElement link) {
if (link.url.contains(
@ -425,10 +432,10 @@ class _ItemScreenState extends State<ItemScreen> {
),
if (state.item.text.isNotEmpty)
const SizedBox(
height: 8,
height: Dimens.pt8,
),
const Divider(
height: 0,
height: Dimens.zero,
),
if (state.onlyShowTargetComment) ...<Widget>[
Center(
@ -440,21 +447,21 @@ class _ItemScreenState extends State<ItemScreen> {
),
),
const Divider(
height: 0,
height: Dimens.zero,
),
] else ...<Widget>[
Row(
children: <Widget>[
if (state.item is Story) ...<Widget>[
const SizedBox(
width: 12,
width: Dimens.pt12,
),
Text(
'''${state.item.score} karma, ${state.item.descendants} comment${state.item.descendants > 1 ? 's' : ''}''',
),
] else ...<Widget>[
const SizedBox(
width: 4,
width: Dimens.pt4,
),
TextButton(
onPressed: context
@ -463,10 +470,10 @@ class _ItemScreenState extends State<ItemScreen> {
child: state.fetchParentStatus ==
CommentsStatus.loading
? const SizedBox(
height: 12,
width: 12,
height: Dimens.pt12,
width: Dimens.pt12,
child: CustomCircularProgressIndicator(
strokeWidth: 2,
strokeWidth: Dimens.pt2,
),
)
: const Text('View parent thread'),
@ -482,7 +489,7 @@ class _ItemScreenState extends State<ItemScreen> {
child: Text(
'Natural',
style: TextStyle(
fontSize: 14,
fontSize: TextDimens.pt14,
),
),
),
@ -491,7 +498,7 @@ class _ItemScreenState extends State<ItemScreen> {
child: Text(
'Newest first',
style: TextStyle(
fontSize: 14,
fontSize: TextDimens.pt14,
),
),
),
@ -500,7 +507,7 @@ class _ItemScreenState extends State<ItemScreen> {
child: Text(
'Oldest first',
style: TextStyle(
fontSize: 14,
fontSize: TextDimens.pt14,
),
),
),
@ -509,12 +516,12 @@ class _ItemScreenState extends State<ItemScreen> {
context.read<CommentsCubit>().onOrderChanged,
),
const SizedBox(
width: 4,
width: Dimens.pt4,
),
],
),
const Divider(
height: 0,
height: Dimens.zero,
),
],
if (state.comments.isEmpty &&
@ -525,7 +532,7 @@ class _ItemScreenState extends State<ItemScreen> {
const Center(
child: Text(
'Nothing yet',
style: TextStyle(color: Colors.grey),
style: TextStyle(color: Palette.grey),
),
),
],
@ -537,15 +544,19 @@ class _ItemScreenState extends State<ItemScreen> {
level: comment.level,
myUsername:
authState.isLoggedIn ? authState.username : null,
opUsername: widget.item.by,
opUsername: state.item.by,
onReplyTapped: (Comment cmt) {
HapticFeedback.lightImpact();
if (cmt.deleted || cmt.dead) {
return;
}
if (cmt !=
context.read<EditCubit>().state.replyingTo) {
if (cmt.id !=
context
.read<EditCubit>()
.state
.replyingTo
?.id) {
commentEditingController.clear();
}
@ -619,9 +630,9 @@ class _ItemScreenState extends State<ItemScreen> {
SplitViewState state,
) {
return Positioned(
top: 0,
left: 0,
right: 0,
top: Dimens.zero,
left: Dimens.zero,
right: Dimens.zero,
child: CustomAppBar(
backgroundColor: Theme.of(context)
.canvasColor
@ -640,9 +651,9 @@ class _ItemScreenState extends State<ItemScreen> {
},
),
Positioned(
bottom: 0,
left: 0,
right: 0,
bottom: Dimens.zero,
left: Dimens.zero,
right: Dimens.zero,
child: ReplyBox(
splitViewEnabled: true,
focusNode: focusNode,
@ -702,15 +713,17 @@ class _ItemScreenState extends State<ItemScreen> {
}
void onRightMoreTapped(Comment comment) {
const double bottomSheetHeight = 140;
HapticFeedback.lightImpact();
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return Container(
height: 140,
height: bottomSheetHeight,
color: Theme.of(context).canvasColor,
child: Material(
color: Colors.transparent,
color: Palette.transparent,
child: Column(
children: <Widget>[
ListTile(
@ -758,28 +771,32 @@ class _ItemScreenState extends State<ItemScreen> {
return Center(
child: Material(
color: Theme.of(context).canvasColor,
borderRadius: const BorderRadius.all(Radius.circular(4)),
borderRadius: const BorderRadius.all(
Radius.circular(
Dimens.pt4,
),
),
child: SizedBox(
height: size.height * 0.8,
width: size.width * widthFactor,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 12,
horizontal: Dimens.pt8,
vertical: Dimens.pt12,
),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
const SizedBox(
width: 8,
width: Dimens.pt8,
),
const Text('Parents:'),
const Spacer(),
IconButton(
icon: const Icon(
Icons.close,
size: 16,
size: Dimens.pt16,
),
onPressed: () => Navigator.pop(context),
padding: EdgeInsets.zero,
@ -799,7 +816,7 @@ class _ItemScreenState extends State<ItemScreen> {
actionable: false,
),
const Divider(
height: 0,
height: Dimens.zero,
),
],
],
@ -893,7 +910,7 @@ class _ItemScreenState extends State<ItemScreen> {
height: item is Comment ? 430 : 450,
color: Theme.of(context).canvasColor,
child: Material(
color: Colors.transparent,
color: Palette.transparent,
child: Column(
children: <Widget>[
BlocProvider<UserCubit>(
@ -923,7 +940,7 @@ class _ItemScreenState extends State<ItemScreen> {
Text(
'empty',
style: TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
],
@ -933,7 +950,7 @@ class _ItemScreenState extends State<ItemScreen> {
state.user.about,
),
linkStyle: const TextStyle(
color: Colors.orange,
color: Palette.orange,
),
onOpen: (LinkableElement link) {
if (link.url.contains(
@ -964,12 +981,12 @@ class _ItemScreenState extends State<ItemScreen> {
ListTile(
leading: Icon(
FeatherIcons.chevronUp,
color: upvoted ? Colors.orange : null,
color: upvoted ? Palette.orange : null,
),
title: Text(
upvoted ? 'Upvoted' : 'Upvote',
style: upvoted
? const TextStyle(color: Colors.orange)
? const TextStyle(color: Palette.orange)
: null,
),
subtitle:
@ -979,12 +996,12 @@ class _ItemScreenState extends State<ItemScreen> {
ListTile(
leading: Icon(
FeatherIcons.chevronDown,
color: downvoted ? Colors.orange : null,
color: downvoted ? Palette.orange : null,
),
title: Text(
downvoted ? 'Downvoted' : 'Downvote',
style: downvoted
? const TextStyle(color: Colors.orange)
? const TextStyle(color: Palette.orange)
: null,
),
onTap: context.read<VoteCubit>().downvote,
@ -1074,7 +1091,7 @@ class _ItemScreenState extends State<ItemScreen> {
content: Text(
'Flag this comment posted by ${item.by}?',
style: const TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
actions: <Widget>[
@ -1112,7 +1129,7 @@ class _ItemScreenState extends State<ItemScreen> {
' and ${isBlocked ? 'display' : 'hide'} '
'comments posted by this user?',
style: const TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
actions: <Widget>[
@ -1187,64 +1204,64 @@ class _ItemScreenState extends State<ItemScreen> {
children: <Widget>[
if (state.status == AuthStatus.loading)
const SizedBox(
height: 36,
width: 36,
height: Dimens.pt36,
width: Dimens.pt36,
child: Center(
child: CircularProgressIndicator(
color: Colors.orange,
color: Palette.orange,
),
),
)
else if (!state.isLoggedIn) ...<Widget>[
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 18,
horizontal: Dimens.pt18,
),
child: TextField(
controller: usernameController,
cursorColor: Colors.orange,
cursorColor: Palette.orange,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Username',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.orange),
borderSide: BorderSide(color: Palette.orange),
),
),
),
),
const SizedBox(
height: 16,
height: Dimens.pt16,
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 18,
horizontal: Dimens.pt18,
),
child: TextField(
controller: passwordController,
cursorColor: Colors.orange,
cursorColor: Palette.orange,
obscureText: true,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Password',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.orange),
borderSide: BorderSide(color: Palette.orange),
),
),
),
),
const SizedBox(
height: 16,
height: Dimens.pt16,
),
if (state.status == AuthStatus.failure)
Padding(
padding: const EdgeInsets.only(
left: 18,
left: Dimens.pt18,
),
child: Text(
'Something went wrong... $sadFace',
style: const TextStyle(
color: Colors.grey,
fontSize: 12,
color: Palette.grey,
fontSize: TextDimens.pt12,
),
),
),
@ -1258,8 +1275,8 @@ class _ItemScreenState extends State<ItemScreen> {
? Icons.check_box
: Icons.check_box_outline_blank,
color: state.agreedToEULA
? Colors.deepOrange
: Colors.grey,
? Palette.deepOrange
: Palette.grey,
),
onPressed: () => context
.read<AuthBloc>()
@ -1284,7 +1301,7 @@ class _ItemScreenState extends State<ItemScreen> {
child: const Text(
'End User Agreement',
style: TextStyle(
color: Colors.deepOrange,
color: Palette.deepOrange,
decoration: TextDecoration.underline,
fontWeight: FontWeight.w600,
),
@ -1299,7 +1316,7 @@ class _ItemScreenState extends State<ItemScreen> {
),
Padding(
padding: const EdgeInsets.only(
right: 12,
right: Dimens.pt12,
),
child: ButtonBar(
children: <Widget>[
@ -1330,15 +1347,15 @@ class _ItemScreenState extends State<ItemScreen> {
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
state.agreedToEULA
? Colors.deepOrange
: Colors.grey,
? Palette.deepOrange
: Palette.grey,
),
),
child: const Text(
'Log in',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
color: Palette.white,
),
),
),

View File

@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/item/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
class CustomAppBar extends AppBar {
CustomAppBar({
@ -18,7 +19,7 @@ class CustomAppBar extends AppBar {
}) : super(
key: key,
backgroundColor: backgroundColor,
elevation: 0,
elevation: Dimens.zero,
actions: <Widget>[
if (splitViewEnabled) ...<Widget>[
IconButton(
@ -26,7 +27,7 @@ class CustomAppBar extends AppBar {
expanded ?? false
? FeatherIcons.minimize2
: FeatherIcons.maximize2,
size: 20,
size: TextDimens.pt20,
),
onPressed: () {
HapticFeedback.lightImpact();

View File

@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/styles/styles.dart';
class FavIconButton extends StatelessWidget {
const FavIconButton({
@ -37,17 +38,17 @@ class FavIconButton extends StatelessWidget {
targetColor: Theme.of(context).primaryColor,
tapTarget: Icon(
isFav ? Icons.favorite : Icons.favorite_border,
color: Colors.white,
color: Palette.white,
),
featureId: Constants.featureAddStoryToFavList,
title: const Text('Fav a Story'),
description: const Text(
'Add it to your favorites.',
style: TextStyle(fontSize: 16),
style: TextStyle(fontSize: TextDimens.pt16),
),
child: Icon(
isFav ? Icons.favorite : Icons.favorite_border,
color: isFav ? Colors.orange : Theme.of(context).iconTheme.color,
color: isFav ? Palette.orange : Theme.of(context).iconTheme.color,
),
),
onPressed: () {

View File

@ -4,6 +4,7 @@ import 'package:feature_discovery/feature_discovery.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class LinkIconButton extends StatelessWidget {
@ -33,7 +34,7 @@ class LinkIconButton extends StatelessWidget {
targetColor: Theme.of(context).primaryColor,
tapTarget: const Icon(
Icons.stream,
color: Colors.white,
color: Palette.white,
),
featureId: Constants.featureOpenStoryInWebView,
title: const Text('Open in Browser'),
@ -41,7 +42,7 @@ class LinkIconButton extends StatelessWidget {
'Want more than just reading and replying? '
'You can tap here to open this story in a '
'browser.',
style: TextStyle(fontSize: 16),
style: TextStyle(fontSize: TextDimens.pt16),
),
child: const Icon(
Icons.stream,

View File

@ -8,6 +8,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/styles/styles.dart';
class PinIconButton extends StatelessWidget {
const PinIconButton({
@ -43,7 +44,7 @@ class PinIconButton extends StatelessWidget {
targetColor: Theme.of(context).primaryColor,
tapTarget: Icon(
pinned ? Icons.push_pin : Icons.push_pin_outlined,
color: Colors.white,
color: Palette.white,
),
featureId: Constants.featurePinToTop,
title: const Text('Pin a Story'),
@ -51,12 +52,12 @@ class PinIconButton extends StatelessWidget {
'Pin this story to the top of your '
'home screen so that you can come'
' back later.',
style: TextStyle(fontSize: 16),
style: TextStyle(fontSize: TextDimens.pt16),
),
child: Icon(
pinned ? Icons.push_pin : Icons.push_pin_outlined,
color: pinned
? Colors.orange
? Palette.orange
: Theme.of(context).iconTheme.color,
),
),

View File

@ -5,6 +5,7 @@ import 'package:flutter_fadein/flutter_fadein.dart';
import 'package:hacki/blocs/auth/auth_bloc.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/styles/styles.dart';
class PollView extends StatelessWidget {
const PollView({
@ -21,29 +22,29 @@ class PollView extends StatelessWidget {
return Column(
children: <Widget>[
const SizedBox(
height: 24,
height: Dimens.pt24,
),
if (state.status == PollStatus.loading) ...<Widget>[
const LinearProgressIndicator(),
const SizedBox(
height: 24,
height: Dimens.pt24,
),
] else ...<Widget>[
Row(
children: <Widget>[
const SizedBox(
width: 24,
width: Dimens.pt24,
),
Text(
'Total votes: ${state.totalVotes}',
style: const TextStyle(
fontSize: 14,
fontSize: TextDimens.pt14,
),
),
],
),
const SizedBox(
height: 12,
height: Dimens.pt12,
),
],
for (final PollOption option in state.pollOptions)
@ -97,9 +98,9 @@ class PollView extends StatelessWidget {
builder: (BuildContext context, VoteState voteState) {
return Padding(
padding: const EdgeInsets.only(
left: 12,
right: 24,
bottom: 4,
left: Dimens.pt12,
right: Dimens.pt24,
bottom: Dimens.pt4,
),
child: Row(
children: <Widget>[
@ -111,9 +112,9 @@ class PollView extends StatelessWidget {
icon: Icon(
Icons.arrow_drop_up,
color: voteState.vote == Vote.up
? Colors.orange
: Colors.grey,
size: 36,
? Palette.orange
: Palette.grey,
size: TextDimens.pt36,
),
),
Expanded(
@ -126,16 +127,16 @@ class PollView extends StatelessWidget {
Text(
'''${option.score} vote${option.score > 1 ? 's' : ''}''',
style: const TextStyle(
color: Colors.grey,
fontSize: 12,
color: Palette.grey,
fontSize: TextDimens.pt12,
),
),
const SizedBox(
height: 4,
height: Dimens.pt4,
),
LinearProgressIndicator(
value: option.ratio,
color: Colors.deepOrange,
color: Palette.deepOrange,
),
],
),
@ -161,7 +162,7 @@ class PollView extends StatelessWidget {
}) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
backgroundColor: Colors.deepOrange,
backgroundColor: Palette.deepOrange,
content: Text(content),
action: action != null && label != null
? SnackBarAction(

View File

@ -6,6 +6,7 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/models/item.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/link_util.dart';
class ReplyBox extends StatefulWidget {
@ -34,6 +35,8 @@ class _ReplyBoxState extends State<ReplyBox> {
bool expanded = false;
double? expandedHeight;
static const double _collapsedHeight = 100;
@override
Widget build(BuildContext context) {
expandedHeight ??= MediaQuery.of(context).size.height;
@ -53,20 +56,21 @@ class _ReplyBoxState extends State<ReplyBox> {
return Padding(
padding: EdgeInsets.only(
bottom: expanded
? 0
? Dimens.zero
: widget.splitViewEnabled
? MediaQuery.of(context).viewInsets.bottom
: 0,
: Dimens.zero,
),
child: AnimatedContainer(
height: expanded ? expandedHeight : 100,
height: expanded ? expandedHeight : _collapsedHeight,
duration: const Duration(milliseconds: 200),
decoration: BoxDecoration(
boxShadow: <BoxShadow>[
if (!context.read<SplitViewCubit>().state.enabled)
BoxShadow(
color: expanded ? Colors.transparent : Colors.black26,
blurRadius: 40,
color:
expanded ? Palette.transparent : Palette.black26,
blurRadius: Dimens.pt40,
),
],
),
@ -75,10 +79,10 @@ class _ReplyBoxState extends State<ReplyBox> {
children: <Widget>[
if (context.read<SplitViewCubit>().state.enabled)
const Divider(
height: 0,
height: Dimens.zero,
),
AnimatedContainer(
height: expanded ? 36 : 0,
height: expanded ? Dimens.pt36 : Dimens.zero,
duration: const Duration(milliseconds: 200),
),
Row(
@ -86,16 +90,16 @@ class _ReplyBoxState extends State<ReplyBox> {
Expanded(
child: Padding(
padding: const EdgeInsets.only(
left: 12,
top: 8,
bottom: 8,
left: Dimens.pt12,
top: Dimens.pt8,
bottom: Dimens.pt8,
),
child: Text(
replyingTo == null
? 'Editing'
: 'Replying '
'${replyingTo.by}',
style: const TextStyle(color: Colors.grey),
style: const TextStyle(color: Palette.grey),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@ -111,8 +115,8 @@ class _ReplyBoxState extends State<ReplyBox> {
key: const Key('quote'),
icon: const Icon(
FeatherIcons.code,
color: Colors.orange,
size: 18,
color: Palette.orange,
size: TextDimens.pt18,
),
onPressed:
expanded ? showTextPopup : null,
@ -124,8 +128,8 @@ class _ReplyBoxState extends State<ReplyBox> {
expanded
? FeatherIcons.minimize2
: FeatherIcons.maximize2,
color: Colors.orange,
size: 18,
color: Palette.orange,
size: TextDimens.pt18,
),
onPressed: () {
setState(() {
@ -138,7 +142,7 @@ class _ReplyBoxState extends State<ReplyBox> {
key: const Key('close'),
icon: const Icon(
Icons.close,
color: Colors.orange,
color: Palette.orange,
),
onPressed: () {
widget.onCloseTapped();
@ -149,15 +153,15 @@ class _ReplyBoxState extends State<ReplyBox> {
if (isLoading)
const Padding(
padding: EdgeInsets.symmetric(
vertical: 12,
horizontal: 16,
vertical: Dimens.pt12,
horizontal: Dimens.pt16,
),
child: SizedBox(
height: 24,
width: 24,
height: Dimens.pt24,
width: Dimens.pt24,
child: CircularProgressIndicator(
color: Colors.orange,
strokeWidth: 2,
color: Palette.orange,
strokeWidth: Dimens.pt2,
),
),
)
@ -166,7 +170,7 @@ class _ReplyBoxState extends State<ReplyBox> {
key: const Key('send'),
icon: const Icon(
Icons.send,
color: Colors.orange,
color: Palette.orange,
),
onPressed: () {
widget.onSendTapped();
@ -177,7 +181,9 @@ class _ReplyBoxState extends State<ReplyBox> {
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(
horizontal: Dimens.pt16,
),
child: TextField(
focusNode: widget.focusNode,
controller: widget.textEditingController,
@ -187,7 +193,7 @@ class _ReplyBoxState extends State<ReplyBox> {
contentPadding: EdgeInsets.zero,
hintText: '...',
hintStyle: TextStyle(
color: Colors.grey,
color: Palette.grey,
),
focusedBorder: InputBorder.none,
border: InputBorder.none,
@ -220,8 +226,8 @@ class _ReplyBoxState extends State<ReplyBox> {
builder: (_) {
return AlertDialog(
insetPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 24,
horizontal: Dimens.pt12,
vertical: Dimens.pt24,
),
contentPadding: EdgeInsets.zero,
content: ConstrainedBox(
@ -233,14 +239,14 @@ class _ReplyBoxState extends State<ReplyBox> {
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
left: 12,
top: 6,
left: Dimens.pt12,
top: Dimens.pt6,
),
child: Row(
children: <Widget>[
Text(
replyingTo?.by ?? '',
style: const TextStyle(color: Colors.grey),
style: const TextStyle(color: Palette.grey),
),
const Spacer(),
TextButton(
@ -252,8 +258,8 @@ class _ReplyBoxState extends State<ReplyBox> {
IconButton(
icon: const Icon(
Icons.close,
color: Colors.orange,
size: 18,
color: Palette.orange,
size: TextDimens.pt18,
),
onPressed: () => Navigator.pop(context),
),
@ -265,17 +271,17 @@ class _ReplyBoxState extends State<ReplyBox> {
thumbVisibility: true,
child: Padding(
padding: const EdgeInsets.only(
left: 12,
right: 6,
top: 6,
left: Dimens.pt12,
right: Dimens.pt6,
top: Dimens.pt6,
),
child: SingleChildScrollView(
child: SelectableLinkify(
scrollPhysics: const NeverScrollableScrollPhysics(),
linkStyle: TextStyle(
fontSize:
MediaQuery.of(context).textScaleFactor * 15,
color: Colors.orange,
fontSize: MediaQuery.of(context).textScaleFactor *
TextDimens.pt15,
color: Palette.orange,
),
onOpen: (LinkableElement link) =>
LinkUtil.launch(link.url),

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:hacki/styles/styles.dart';
class ScrollUpIconButton extends StatefulWidget {
const ScrollUpIconButton({
@ -35,8 +36,8 @@ class _ScrollUpIconButtonState extends State<ScrollUpIconButton> {
child: IconButton(
icon: const Icon(
FeatherIcons.chevronsUp,
color: Colors.orange,
size: 26,
color: Palette.orange,
size: TextDimens.pt26,
),
onPressed: () {
final double curPos = widget.scrollController.offset;

View File

@ -18,6 +18,7 @@ import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/screens/profile/widgets/widgets.dart';
import 'package:hacki/screens/screens.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:tuple/tuple.dart';
@ -91,7 +92,7 @@ class _ProfileScreenState extends State<ProfileScreen>
return Stack(
children: <Widget>[
Positioned.fill(
top: 50,
top: Dimens.pt50,
child: Visibility(
visible: pageType == _PageType.history,
child: BlocConsumer<HistoryCubit, HistoryState>(
@ -148,7 +149,7 @@ class _ProfileScreenState extends State<ProfileScreen>
),
),
Positioned.fill(
top: 50,
top: Dimens.pt50,
child: Visibility(
visible: pageType == _PageType.fav,
child: BlocConsumer<FavCubit, FavState>(
@ -192,7 +193,7 @@ class _ProfileScreenState extends State<ProfileScreen>
),
),
Positioned.fill(
top: 50,
top: Dimens.pt50,
child: Visibility(
visible: pageType == _PageType.search,
maintainState: true,
@ -200,7 +201,7 @@ class _ProfileScreenState extends State<ProfileScreen>
),
),
Positioned.fill(
top: 50,
top: Dimens.pt50,
child: Visibility(
visible: pageType == _PageType.notification,
child: notificationState.comments.isEmpty
@ -241,7 +242,7 @@ class _ProfileScreenState extends State<ProfileScreen>
),
),
Positioned.fill(
top: 50,
top: Dimens.pt50,
child: Visibility(
visible: pageType == _PageType.settings,
child: SingleChildScrollView(
@ -280,7 +281,7 @@ class _ProfileScreenState extends State<ProfileScreen>
.read<PreferenceCubit>()
.toggleNotificationMode();
},
activeColor: Colors.orange,
activeColor: Palette.orange,
),
SwitchListTile(
title: const Text('Complex Story Tile'),
@ -294,7 +295,7 @@ class _ProfileScreenState extends State<ProfileScreen>
.read<PreferenceCubit>()
.toggleDisplayMode();
},
activeColor: Colors.orange,
activeColor: Palette.orange,
),
SwitchListTile(
title: const Text('Show Metadata'),
@ -309,7 +310,7 @@ class _ProfileScreenState extends State<ProfileScreen>
.read<PreferenceCubit>()
.toggleMetadataMode();
},
activeColor: Colors.orange,
activeColor: Palette.orange,
),
SwitchListTile(
title: const Text('Show Web Page First'),
@ -324,7 +325,7 @@ class _ProfileScreenState extends State<ProfileScreen>
.read<PreferenceCubit>()
.toggleNavigationMode();
},
activeColor: Colors.orange,
activeColor: Palette.orange,
),
if (Platform.isIOS)
SwitchListTile(
@ -340,7 +341,7 @@ class _ProfileScreenState extends State<ProfileScreen>
.read<PreferenceCubit>()
.toggleReaderMode();
},
activeColor: Colors.orange,
activeColor: Palette.orange,
),
SwitchListTile(
title: const Text('Mark Read Stories'),
@ -361,7 +362,7 @@ class _ProfileScreenState extends State<ProfileScreen>
.read<PreferenceCubit>()
.toggleMarkReadStoriesMode();
},
activeColor: Colors.orange,
activeColor: Palette.orange,
),
SwitchListTile(
title: const Text('Eye Candy'),
@ -373,7 +374,7 @@ class _ProfileScreenState extends State<ProfileScreen>
.read<PreferenceCubit>()
.toggleEyeCandyMode();
},
activeColor: Colors.orange,
activeColor: Palette.orange,
),
SwitchListTile(
title: const Text('True Dark Mode'),
@ -387,7 +388,7 @@ class _ProfileScreenState extends State<ProfileScreen>
.read<PreferenceCubit>()
.toggleTrueDarkMode();
},
activeColor: Colors.orange,
activeColor: Palette.orange,
),
ListTile(
title: const Text(
@ -409,15 +410,17 @@ class _ProfileScreenState extends State<ProfileScreen>
showAboutDialog(
context: context,
applicationName: 'Hacki',
applicationVersion: 'v0.2.21',
applicationVersion: 'v0.2.22',
applicationIcon: ClipRRect(
borderRadius: const BorderRadius.all(
Radius.circular(12),
Radius.circular(
Dimens.pt12,
),
),
child: Image.asset(
Constants.hackiIconPath,
height: 50,
width: 50,
height: Dimens.pt50,
width: Dimens.pt50,
),
),
children: <Widget>[
@ -431,7 +434,7 @@ class _ProfileScreenState extends State<ProfileScreen>
FontAwesomeIcons.addressCard,
),
SizedBox(
width: 12,
width: Dimens.pt12,
),
Text('Developer'),
],
@ -447,7 +450,7 @@ class _ProfileScreenState extends State<ProfileScreen>
FontAwesomeIcons.github,
),
SizedBox(
width: 12,
width: Dimens.pt12,
),
Text('Source code'),
],
@ -465,7 +468,7 @@ class _ProfileScreenState extends State<ProfileScreen>
Icons.thumb_up,
),
SizedBox(
width: 12,
width: Dimens.pt12,
),
Text('Like the app?'),
],
@ -481,7 +484,7 @@ class _ProfileScreenState extends State<ProfileScreen>
FeatherIcons.coffee,
),
SizedBox(
width: 12,
width: Dimens.pt12,
),
Text('Buy me a coffee'),
],
@ -492,7 +495,7 @@ class _ProfileScreenState extends State<ProfileScreen>
},
),
const SizedBox(
height: 48,
height: Dimens.pt48,
),
],
),
@ -507,7 +510,7 @@ class _ProfileScreenState extends State<ProfileScreen>
child: Row(
children: <Widget>[
const SizedBox(
width: 12,
width: Dimens.pt12,
),
CustomChip(
label: 'Submit',
@ -526,7 +529,7 @@ class _ProfileScreenState extends State<ProfileScreen>
},
),
const SizedBox(
width: 12,
width: Dimens.pt12,
),
CustomChip(
label: 'Inbox : '
@ -542,7 +545,7 @@ class _ProfileScreenState extends State<ProfileScreen>
},
),
const SizedBox(
width: 12,
width: Dimens.pt12,
),
CustomChip(
label: 'Favorite',
@ -556,7 +559,7 @@ class _ProfileScreenState extends State<ProfileScreen>
},
),
const SizedBox(
width: 12,
width: Dimens.pt12,
),
CustomChip(
label: 'Submitted',
@ -570,7 +573,7 @@ class _ProfileScreenState extends State<ProfileScreen>
},
),
const SizedBox(
width: 12,
width: Dimens.pt12,
),
CustomChip(
label: 'Search',
@ -584,7 +587,7 @@ class _ProfileScreenState extends State<ProfileScreen>
},
),
const SizedBox(
width: 12,
width: Dimens.pt12,
),
CustomChip(
label: 'Settings',
@ -598,7 +601,7 @@ class _ProfileScreenState extends State<ProfileScreen>
},
),
const SizedBox(
width: 12,
width: Dimens.pt12,
),
],
),
@ -666,7 +669,7 @@ class _ProfileScreenState extends State<ProfileScreen>
child: const Text(
'Cancel',
style: TextStyle(
color: Colors.orange,
color: Palette.orange,
),
),
),
@ -743,64 +746,64 @@ class _ProfileScreenState extends State<ProfileScreen>
children: <Widget>[
if (state.status == AuthStatus.loading)
const SizedBox(
height: 36,
width: 36,
height: Dimens.pt36,
width: Dimens.pt36,
child: Center(
child: CircularProgressIndicator(
color: Colors.orange,
color: Palette.orange,
),
),
)
else if (!state.isLoggedIn) ...<Widget>[
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 18,
horizontal: Dimens.pt18,
),
child: TextField(
controller: usernameController,
cursorColor: Colors.orange,
cursorColor: Palette.orange,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Username',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.orange),
borderSide: BorderSide(color: Palette.orange),
),
),
),
),
const SizedBox(
height: 16,
height: Dimens.pt16,
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 18,
horizontal: Dimens.pt18,
),
child: TextField(
controller: passwordController,
cursorColor: Colors.orange,
cursorColor: Palette.orange,
obscureText: true,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Password',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.orange),
borderSide: BorderSide(color: Palette.orange),
),
),
),
),
const SizedBox(
height: 16,
height: Dimens.pt16,
),
if (state.status == AuthStatus.failure)
const Padding(
padding: EdgeInsets.only(
left: 18,
left: Dimens.pt18,
),
child: Text(
'Something went wrong...',
style: TextStyle(
color: Colors.grey,
fontSize: 12,
color: Palette.grey,
fontSize: TextDimens.pt12,
),
),
),
@ -814,8 +817,8 @@ class _ProfileScreenState extends State<ProfileScreen>
? Icons.check_box
: Icons.check_box_outline_blank,
color: state.agreedToEULA
? Colors.deepOrange
: Colors.grey,
? Palette.deepOrange
: Palette.grey,
),
onPressed: () => context
.read<AuthBloc>()
@ -840,7 +843,7 @@ class _ProfileScreenState extends State<ProfileScreen>
child: const Text(
'End User Agreement',
style: TextStyle(
color: Colors.deepOrange,
color: Palette.deepOrange,
decoration: TextDecoration.underline,
fontWeight: FontWeight.w600,
),
@ -855,7 +858,7 @@ class _ProfileScreenState extends State<ProfileScreen>
),
Padding(
padding: const EdgeInsets.only(
right: 12,
right: Dimens.pt12,
),
child: ButtonBar(
children: <Widget>[
@ -886,15 +889,15 @@ class _ProfileScreenState extends State<ProfileScreen>
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
state.agreedToEULA
? Colors.deepOrange
: Colors.grey,
? Palette.deepOrange
: Palette.grey,
),
),
child: const Text(
'Log in',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
color: Palette.white,
),
),
),
@ -921,7 +924,7 @@ class _ProfileScreenState extends State<ProfileScreen>
content: Text(
'Log out as ${authBloc.state.username}?',
style: const TextStyle(
fontSize: 16,
fontSize: TextDimens.pt16,
),
),
actions: <Widget>[

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:hacki/styles/styles.dart';
class CenteredMessageView extends StatelessWidget {
const CenteredMessageView({
@ -12,14 +13,14 @@ class CenteredMessageView extends StatelessWidget {
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
top: 120,
left: 40,
right: 40,
top: Dimens.pt120,
left: Dimens.pt40,
right: Dimens.pt40,
),
child: Text(
content,
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.grey),
style: const TextStyle(color: Palette.grey),
),
);
}

View File

@ -3,6 +3,7 @@ import 'package:flutter_fadein/flutter_fadein.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/link_util.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -29,8 +30,8 @@ class InboxView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final Color textColor = Theme.of(context).brightness == Brightness.dark
? Colors.white
: Colors.black;
? Palette.white
: Palette.black;
return Column(
children: <Widget>[
if (unreadCommentsIds.isNotEmpty)
@ -42,12 +43,14 @@ class InboxView extends StatelessWidget {
child: SmartRefresher(
enablePullUp: true,
header: const WaterDropMaterialHeader(
backgroundColor: Colors.orange,
backgroundColor: Palette.orange,
),
footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus? mode) {
Widget body;
const double height = 55;
late final Widget body;
if (mode == LoadStatus.loading) {
body = const CustomCircularProgressIndicator();
} else if (mode == LoadStatus.failed) {
@ -58,7 +61,7 @@ class InboxView extends StatelessWidget {
body = const SizedBox.shrink();
}
return SizedBox(
height: 55,
height: height,
child: Center(child: body),
);
},
@ -72,7 +75,9 @@ class InboxView extends StatelessWidget {
return <Widget>[
FadeIn(
child: Padding(
padding: const EdgeInsets.only(left: 6),
padding: const EdgeInsets.only(
left: Dimens.pt6,
),
child: InkWell(
onTap: () => onCommentTapped(e),
child: Padding(
@ -87,8 +92,8 @@ class InboxView extends StatelessWidget {
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 6,
vertical: Dimens.pt8,
horizontal: Dimens.pt6,
),
child: Linkify(
text: '${e.by} : ${e.text}',
@ -96,13 +101,13 @@ class InboxView extends StatelessWidget {
color:
unreadCommentsIds.contains(e.id)
? textColor
: Colors.grey,
: Palette.grey,
),
linkStyle: TextStyle(
color:
unreadCommentsIds.contains(e.id)
? Colors.orange
: Colors.orange
? Palette.orange
: Palette.orange
.withOpacity(0.6),
),
maxLines: 4,
@ -116,18 +121,18 @@ class InboxView extends StatelessWidget {
Text(
e.postedDate,
style: const TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
const SizedBox(
width: 12,
width: Dimens.pt12,
),
],
),
],
),
const Divider(
height: 0,
height: Dimens.zero,
),
],
),
@ -136,12 +141,12 @@ class InboxView extends StatelessWidget {
),
),
const Divider(
height: 0,
height: Dimens.zero,
),
];
}).expand((List<Widget> element) => element),
const SizedBox(
height: 40,
height: Dimens.pt40,
),
],
),

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:wakelock/wakelock.dart';
class OfflineListTile extends StatelessWidget {
@ -32,8 +33,8 @@ class OfflineListTile extends StatelessWidget {
final Widget trailingWidget = () {
if (downloading) {
return const SizedBox(
height: 24,
width: 24,
height: Dimens.pt24,
width: Dimens.pt24,
child: CustomCircularProgressIndicator(),
);
} else if (downloaded) {

View File

@ -7,6 +7,7 @@ import 'package:hacki/models/models.dart';
import 'package:hacki/screens/screens.dart';
import 'package:hacki/screens/search/widgets/widgets.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -38,14 +39,16 @@ class _SearchScreenState extends State<SearchScreen> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
padding: const EdgeInsets.symmetric(
horizontal: Dimens.pt12,
),
child: TextField(
cursorColor: Colors.orange,
cursorColor: Palette.orange,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Search Hacker News',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.orange),
borderSide: BorderSide(color: Palette.orange),
),
),
onChanged: (String val) {
@ -58,7 +61,7 @@ class _SearchScreenState extends State<SearchScreen> {
),
),
const SizedBox(
height: 6,
height: Dimens.pt6,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
@ -83,7 +86,7 @@ class _SearchScreenState extends State<SearchScreen> {
.removeFilter<DateTimeRangeFilter>,
),
const SizedBox(
width: 8,
width: Dimens.pt8,
),
CustomChip(
onSelected: (_) =>
@ -92,7 +95,7 @@ class _SearchScreenState extends State<SearchScreen> {
label: '''newest first''',
),
const SizedBox(
width: 8,
width: Dimens.pt8,
),
for (final CustomDateTimeRange range
in CustomDateTimeRange.values) ...<Widget>[
@ -107,7 +110,7 @@ class _SearchScreenState extends State<SearchScreen> {
),
),
const SizedBox(
width: 8,
width: Dimens.pt8,
),
],
],
@ -116,7 +119,7 @@ class _SearchScreenState extends State<SearchScreen> {
if (state.status == SearchStatus.loading &&
state.results.isEmpty) ...<Widget>[
const SizedBox(
height: 100,
height: Dimens.pt100,
),
const CustomCircularProgressIndicator(),
],
@ -125,12 +128,14 @@ class _SearchScreenState extends State<SearchScreen> {
enablePullDown: false,
enablePullUp: true,
header: const WaterDropMaterialHeader(
backgroundColor: Colors.orange,
backgroundColor: Palette.orange,
),
footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus? mode) {
Widget body;
const double height = 55;
late final Widget body;
if (mode == LoadStatus.loading) {
body = const CustomCircularProgressIndicator();
} else if (mode == LoadStatus.failed) {
@ -140,8 +145,9 @@ class _SearchScreenState extends State<SearchScreen> {
} else {
body = const SizedBox.shrink();
}
return SizedBox(
height: 55,
height: height,
child: Center(child: body),
);
},
@ -169,14 +175,14 @@ class _SearchScreenState extends State<SearchScreen> {
),
if (!prefState.showComplexStoryTile)
const Divider(
height: 0,
height: Dimens.zero,
),
],
)
.expand((List<Widget> e) => e)
.toList(),
const SizedBox(
height: 40,
height: Dimens.pt40,
),
],
),

View File

@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/extensions/extensions.dart';
import 'package:hacki/styles/styles.dart';
class SubmitScreen extends StatefulWidget {
const SubmitScreen({super.key});
@ -58,7 +59,7 @@ class _SubmitScreenState extends State<SubmitScreen> {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).canvasColor,
elevation: 0,
elevation: Dimens.zero,
leading: IconButton(
icon: const Icon(Icons.close),
onPressed: () {
@ -78,7 +79,7 @@ class _SubmitScreenState extends State<SubmitScreen> {
child: const Text(
'Yes',
style: TextStyle(
color: Colors.red,
color: Palette.red,
),
),
),
@ -99,14 +100,14 @@ class _SubmitScreenState extends State<SubmitScreen> {
if (state.status == SubmitStatus.submitting)
const Padding(
padding: EdgeInsets.symmetric(
vertical: 18,
horizontal: 16,
vertical: Dimens.pt18,
horizontal: Dimens.pt16,
),
child: SizedBox(
height: 20,
width: 20,
height: Dimens.pt20,
width: Dimens.pt20,
child: CircularProgressIndicator(
color: Colors.orange,
color: Palette.orange,
strokeWidth: 2,
),
),
@ -115,7 +116,7 @@ class _SubmitScreenState extends State<SubmitScreen> {
IconButton(
icon: const Icon(
Icons.send,
color: Colors.orange,
color: Palette.orange,
),
onPressed: context.read<SubmitCubit>().onSubmitTapped,
)
@ -123,7 +124,7 @@ class _SubmitScreenState extends State<SubmitScreen> {
IconButton(
icon: const Icon(
Icons.send,
color: Colors.grey,
color: Palette.grey,
),
onPressed: () {},
),
@ -132,50 +133,58 @@ class _SubmitScreenState extends State<SubmitScreen> {
body: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
padding: const EdgeInsets.symmetric(
horizontal: Dimens.pt12,
),
child: TextField(
controller: titleEditingController,
cursorColor: Colors.orange,
cursorColor: Palette.orange,
autocorrect: false,
maxLength: 80,
decoration: const InputDecoration(
hintText: 'Title',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.orange),
borderSide: BorderSide(color: Palette.orange),
),
),
onChanged: context.read<SubmitCubit>().onTitleChanged,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
padding: const EdgeInsets.symmetric(
horizontal: Dimens.pt12,
),
child: TextField(
enabled: textEditingController.text.isEmpty,
controller: urlEditingController,
cursorColor: Colors.orange,
cursorColor: Palette.orange,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Url',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.orange),
borderSide: BorderSide(color: Palette.orange),
),
),
onChanged: context.read<SubmitCubit>().onUrlChanged,
),
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 12),
padding: EdgeInsets.symmetric(
vertical: Dimens.pt12,
),
child: Center(
child: Text('or'),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
padding: const EdgeInsets.symmetric(
horizontal: Dimens.pt12,
),
child: TextField(
enabled: urlEditingController.text.isEmpty,
controller: textEditingController,
cursorColor: Colors.orange,
cursorColor: Palette.orange,
maxLines: 200,
decoration: const InputDecoration(
hintText: 'Text',

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hacki/config/locator.dart';
import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/styles/styles.dart';
import 'package:webview_flutter/webview_flutter.dart';
class WebViewScreen extends StatefulWidget {
@ -24,7 +25,7 @@ class _WebViewScreenState extends State<WebViewScreen> {
title: Text(
humanize(widget.url),
style: const TextStyle(
fontSize: 12,
fontSize: TextDimens.pt12,
),
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,

View File

@ -7,6 +7,7 @@ import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/extensions/extensions.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class CommentTile extends StatelessWidget {
@ -67,8 +68,8 @@ class CommentTile extends StatelessWidget {
SlidableAction(
onPressed: (_) =>
onReplyTapped?.call(comment),
backgroundColor: Colors.orange,
foregroundColor: Colors.white,
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.message,
),
if (context
@ -80,15 +81,15 @@ class CommentTile extends StatelessWidget {
SlidableAction(
onPressed: (_) =>
onEditTapped?.call(comment),
backgroundColor: Colors.orange,
foregroundColor: Colors.white,
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.edit,
),
SlidableAction(
onPressed: (_) =>
onMoreTapped?.call(comment),
backgroundColor: Colors.orange,
foregroundColor: Colors.white,
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.more_horiz,
),
],
@ -101,8 +102,8 @@ class CommentTile extends StatelessWidget {
SlidableAction(
onPressed: (_) =>
onRightMoreTapped?.call(comment),
backgroundColor: Colors.orange,
foregroundColor: Colors.white,
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: Icons.av_timer,
),
],
@ -111,7 +112,7 @@ class CommentTile extends StatelessWidget {
child: InkWell(
onTap: () {
if (actionable) {
HapticFeedback.lightImpact();
HapticFeedback.selectionClick();
context.read<CollapseCubit>().collapse();
}
},
@ -120,9 +121,9 @@ class CommentTile extends StatelessWidget {
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
left: 6,
right: 6,
top: 6,
left: Dimens.pt6,
right: Dimens.pt6,
top: Dimens.pt6,
),
child: Row(
children: <Widget>[
@ -145,7 +146,7 @@ class CommentTile extends StatelessWidget {
Text(
comment.postedDate,
style: const TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
],
@ -154,13 +155,14 @@ class CommentTile extends StatelessWidget {
if (actionable && state.collapsed)
Center(
child: Padding(
padding:
const EdgeInsets.only(bottom: 12),
padding: const EdgeInsets.only(
bottom: Dimens.pt12,
),
child: Text(
'collapsed '
'(${state.collapsedCount + 1})',
style: const TextStyle(
color: Colors.orangeAccent,
color: Palette.orangeAccent,
),
),
),
@ -168,11 +170,13 @@ class CommentTile extends StatelessWidget {
else if (comment.deleted)
const Center(
child: Padding(
padding: EdgeInsets.only(bottom: 12),
padding: EdgeInsets.only(
bottom: Dimens.pt12,
),
child: Text(
'deleted',
style: TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
),
@ -180,11 +184,13 @@ class CommentTile extends StatelessWidget {
else if (comment.dead)
const Center(
child: Padding(
padding: EdgeInsets.only(bottom: 12),
padding: EdgeInsets.only(
bottom: Dimens.pt12,
),
child: Text(
'dead',
style: TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
),
@ -193,11 +199,13 @@ class CommentTile extends StatelessWidget {
.contains(comment.by))
const Center(
child: Padding(
padding: EdgeInsets.only(bottom: 12),
padding: EdgeInsets.only(
bottom: Dimens.pt12,
),
child: Text(
'blocked',
style: TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
),
@ -205,10 +213,10 @@ class CommentTile extends StatelessWidget {
else
Padding(
padding: const EdgeInsets.only(
left: 8,
right: 8,
top: 6,
bottom: 12,
left: Dimens.pt8,
right: Dimens.pt8,
top: Dimens.pt6,
bottom: Dimens.pt12,
),
child: comment is BuildableComment
? SelectableText.rich(
@ -219,15 +227,15 @@ class CommentTile extends StatelessWidget {
style: TextStyle(
fontSize: MediaQuery.of(context)
.textScaleFactor *
15,
TextDimens.pt15,
),
linkStyle: TextStyle(
fontSize: MediaQuery.of(context)
.textScaleFactor *
15,
TextDimens.pt15,
decoration:
TextDecoration.underline,
color: Colors.orange,
color: Palette.orange,
),
onOpen: (LinkableElement link) {
if (link.url.contains(
@ -247,13 +255,13 @@ class CommentTile extends StatelessWidget {
style: TextStyle(
fontSize: MediaQuery.of(context)
.textScaleFactor *
15,
TextDimens.pt15,
),
linkStyle: TextStyle(
fontSize: MediaQuery.of(context)
.textScaleFactor *
15,
color: Colors.orange,
TextDimens.pt15,
color: Palette.orange,
),
onOpen: (LinkableElement link) {
if (link.url.contains(
@ -268,7 +276,7 @@ class CommentTile extends StatelessWidget {
),
),
const Divider(
height: 0,
height: Dimens.zero,
),
],
),
@ -285,14 +293,14 @@ class CommentTile extends StatelessWidget {
final Color commentColor = prefState.showEyeCandy
? color.withOpacity(commentBackgroundColorOpacity)
: Colors.transparent;
: Palette.transparent;
final bool isMyComment = myUsername == comment.by;
Widget? wrapper = child;
if (isMyComment && level == 0) {
return Container(
color: Colors.orange.withOpacity(0.2),
color: Palette.orange.withOpacity(0.2),
child: wrapper,
);
}
@ -301,7 +309,9 @@ class CommentTile extends StatelessWidget {
final Color wrapperBorderColor = _getColor(i);
final bool shouldHighlight = isMyComment && i == level;
wrapper = Container(
margin: const EdgeInsets.only(left: 12),
margin: const EdgeInsets.only(
left: Dimens.pt12,
),
decoration: BoxDecoration(
border: i != 0
? Border(
@ -311,7 +321,7 @@ class CommentTile extends StatelessWidget {
)
: null,
color: shouldHighlight
? Colors.orange.withOpacity(0.2)
? Palette.orange.withOpacity(0.2)
: commentColor,
),
child: wrapper,

View File

@ -7,6 +7,7 @@ import 'package:hacki/extensions/extensions.dart';
import 'package:hacki/models/story.dart';
import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/screens/screens.dart';
import 'package:hacki/styles/styles.dart';
class CountdownReminder extends StatefulWidget {
const CountdownReminder({super.key});
@ -95,9 +96,13 @@ class _CountDownReminderState extends State<CountdownReminder>
animation: animationController,
child: FadeIn(
child: Material(
color: Colors.deepOrange,
color: Palette.deepOrange,
clipBehavior: Clip.hardEdge,
borderRadius: const BorderRadius.all(Radius.circular(4)),
borderRadius: const BorderRadius.all(
Radius.circular(
Dimens.pt4,
),
),
child: InkWell(
onTap: () {
if (state.storyId != null) {
@ -122,24 +127,24 @@ class _CountDownReminderState extends State<CountdownReminder>
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
left: 12,
top: 10,
right: 10,
left: Dimens.pt12,
top: Dimens.pt10,
right: Dimens.pt10,
),
child: Row(
children: const <Widget>[
Text(
'Pick up where you left off',
style: TextStyle(
color: Colors.white,
fontSize: 12,
color: Palette.white,
fontSize: TextDimens.pt12,
),
),
Spacer(),
Icon(
Icons.arrow_forward_ios,
size: 12,
color: Colors.white,
size: TextDimens.pt12,
color: Palette.white,
),
],
),

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:hacki/styles/styles.dart';
class CustomChip extends StatelessWidget {
CustomChip({
@ -15,16 +16,16 @@ class CustomChip extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FilterChip(
shadowColor: Colors.transparent,
selectedShadowColor: Colors.transparent,
backgroundColor: Colors.transparent,
shadowColor: Palette.transparent,
selectedShadowColor: Palette.transparent,
backgroundColor: Palette.transparent,
shape: const StadiumBorder(
side: BorderSide(color: Colors.orange),
side: BorderSide(color: Palette.orange),
),
label: Text(label),
selected: selected,
onSelected: onSelected,
selectedColor: Colors.orange,
selectedColor: Palette.orange,
);
}
}

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:hacki/styles/styles.dart';
/// Circular progress indicator with color.
/// Changing `colorScheme`'s `primary` color doesn't work because it changes
@ -17,7 +18,7 @@ class CustomCircularProgressIndicator extends StatelessWidget {
Widget build(BuildContext context) {
return CircularProgressIndicator(
strokeWidth: strokeWidth,
valueColor: const AlwaysStoppedAnimation<Color>(Colors.orange),
valueColor: const AlwaysStoppedAnimation<Color>(Palette.orange),
);
}
}

View File

@ -7,6 +7,7 @@ import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:hacki/blocs/blocs.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';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -80,8 +81,8 @@ class ItemsListView<T extends Item> extends StatelessWidget {
HapticFeedback.lightImpact();
onPinned?.call(e);
},
backgroundColor: Colors.orange,
foregroundColor: Colors.white,
backgroundColor: Palette.orange,
foregroundColor: Palette.white,
icon: showWebPreview
? Icons.push_pin_outlined
: null,
@ -97,13 +98,15 @@ class ItemsListView<T extends Item> extends StatelessWidget {
showWebPreview: showWebPreview,
showMetadata: showMetadata,
hasRead: markReadStories && hasRead,
simpleTileFontSize: useConsistentFontSize ? 14 : 16,
simpleTileFontSize: useConsistentFontSize
? TextDimens.pt14
: TextDimens.pt16,
),
),
),
if (!showWebPreview)
const Divider(
height: 0,
height: Dimens.zero,
),
];
} else if (e is Comment) {
@ -111,22 +114,22 @@ class ItemsListView<T extends Item> extends StatelessWidget {
return <Widget>[
if (showWebPreview)
const Divider(
height: 0,
height: Dimens.zero,
),
_CommentTile(
comment: e,
onTap: () => onTap(e),
fontSize: showWebPreview ? 14 : 16,
fontSize: showWebPreview ? TextDimens.pt14 : TextDimens.pt16,
),
const Divider(
height: 0,
height: Dimens.zero,
),
];
}
return <Widget>[
FadeIn(
child: Padding(
padding: const EdgeInsets.only(left: 6),
padding: const EdgeInsets.only(left: Dimens.pt6),
child: InkWell(
onTap: () => onTap(e),
child: Padding(
@ -137,10 +140,12 @@ class ItemsListView<T extends Item> extends StatelessWidget {
if (e.deleted)
const Center(
child: Padding(
padding: EdgeInsets.only(top: 6),
padding: EdgeInsets.only(
top: Dimens.pt6,
),
child: Text(
'deleted',
style: TextStyle(color: Colors.grey),
style: TextStyle(color: Palette.grey),
),
),
),
@ -151,15 +156,15 @@ class ItemsListView<T extends Item> extends StatelessWidget {
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 6,
vertical: Dimens.pt8,
horizontal: Dimens.pt6,
),
child: Linkify(
text:
'''${showCommentBy ? '${e.by}: ' : ''}${e.text}''',
maxLines: 4,
linkStyle: const TextStyle(
color: Colors.orange,
color: Palette.orange,
),
onOpen: (LinkableElement link) =>
LinkUtil.launch(link.url),
@ -171,18 +176,18 @@ class ItemsListView<T extends Item> extends StatelessWidget {
Text(
e.postedDate,
style: const TextStyle(
color: Colors.grey,
color: Palette.grey,
),
),
const SizedBox(
width: 12,
width: Dimens.pt12,
),
],
),
],
),
const Divider(
height: 0,
height: Dimens.zero,
),
],
),
@ -191,7 +196,7 @@ class ItemsListView<T extends Item> extends StatelessWidget {
),
),
const Divider(
height: 0,
height: Dimens.zero,
),
];
}
@ -199,7 +204,7 @@ class ItemsListView<T extends Item> extends StatelessWidget {
return <Widget>[Container()];
}).expand((List<Widget> element) => element),
const SizedBox(
height: 40,
height: Dimens.pt40,
),
],
);
@ -208,12 +213,14 @@ class ItemsListView<T extends Item> extends StatelessWidget {
enablePullUp: true,
enablePullDown: enablePullDown,
header: const WaterDropMaterialHeader(
backgroundColor: Colors.orange,
backgroundColor: Palette.orange,
),
footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus? mode) {
Widget body;
const double height = 55;
late final Widget body;
if (mode == LoadStatus.loading) {
body = const CustomCircularProgressIndicator();
} else if (mode == LoadStatus.failed) {
@ -224,7 +231,7 @@ class ItemsListView<T extends Item> extends StatelessWidget {
body = const SizedBox.shrink();
}
return SizedBox(
height: 55,
height: height,
child: Center(child: body),
);
},
@ -254,12 +261,14 @@ class _CommentTile extends StatelessWidget {
return InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.only(left: 12),
padding: const EdgeInsets.only(
left: Dimens.pt12,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(
height: 8,
height: Dimens.pt8,
),
Row(
children: <Widget>[
@ -281,7 +290,7 @@ class _CommentTile extends StatelessWidget {
child: Text(
comment.metadata,
style: TextStyle(
color: Colors.grey,
color: Palette.grey,
fontSize: fontSize - 2,
),
maxLines: 1,
@ -290,7 +299,7 @@ class _CommentTile extends StatelessWidget {
],
),
const SizedBox(
height: 8,
height: Dimens.pt8,
),
],
),

View File

@ -5,6 +5,7 @@ import 'package:hacki/config/constants.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/widgets/link_preview/link_view.dart';
import 'package:hacki/screens/widgets/link_preview/web_analyzer.dart';
import 'package:hacki/styles/styles.dart';
import 'package:url_launcher/url_launcher.dart';
class LinkPreview extends StatefulWidget {
@ -97,7 +98,7 @@ class LinkPreview extends StatefulWidget {
final bool removeElevation;
/// Box shadow for the card. Defaults to
/// `[BoxShadow(blurRadius: 3, color: Colors.grey)]`
/// `[BoxShadow(blurRadius: 3, color: Palette.grey)]`
final List<BoxShadow>? boxShadow;
final bool showMetadata;
@ -163,11 +164,15 @@ class _LinkPreviewState extends State<LinkPreview> {
return Container(
decoration: BoxDecoration(
color: widget.backgroundColor,
borderRadius: BorderRadius.circular(widget.borderRadius ?? 12),
borderRadius: BorderRadius.circular(
widget.borderRadius ?? Dimens.pt12,
),
boxShadow: widget.removeElevation
? <BoxShadow>[]
: widget.boxShadow ??
<BoxShadow>[const BoxShadow(blurRadius: 3, color: Colors.grey)],
<BoxShadow>[
const BoxShadow(blurRadius: 3, color: Palette.grey),
],
),
height: _height,
child: LinkView(
@ -194,19 +199,29 @@ class _LinkPreviewState extends State<LinkPreview> {
@override
Widget build(BuildContext context) {
const double screenWidthLowerBound = 428,
screenWidthUpperBound = 850,
picHeightLowerBound = 118,
picHeightUpperBound = 140,
smallPicHeight = 100,
picHeightFactor = 0.14;
final double screenWidth = MediaQuery.of(context).size.width;
final bool showSmallerPreviewPic = screenWidth > 428.0 && screenWidth < 850;
final double _height = showSmallerPreviewPic
? 100.0
: (MediaQuery.of(context).size.height * 0.14).clamp(118.0, 140.0);
final bool showSmallerPreviewPic = screenWidth > screenWidthLowerBound &&
screenWidth < screenWidthUpperBound;
final double height = showSmallerPreviewPic
? smallPicHeight
: (MediaQuery.of(context).size.height * picHeightFactor)
.clamp(picHeightLowerBound, picHeightUpperBound);
final Widget loadingWidget = widget.placeholderWidget ??
Container(
height: _height,
height: height,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(widget.borderRadius ?? 12),
color: Colors.grey[200],
borderRadius: BorderRadius.circular(
widget.borderRadius ?? Dimens.pt12,
),
color: Palette.grey[200],
),
alignment: Alignment.center,
child: const Text('Fetching data...'),
@ -217,13 +232,13 @@ class _LinkPreviewState extends State<LinkPreview> {
final WebInfo? info = _info as WebInfo?;
loadedWidget = _info == null
? _buildLinkContainer(
_height,
height,
title: _errorTitle,
desc: _errorBody,
imageUri: null,
)
: _buildLinkContainer(
_height,
height,
title: _errorTitle,
desc: WebAnalyzer.isNotEmpty(info!.description)
? info.description

View File

@ -1,6 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/styles/styles.dart';
class LinkView extends StatelessWidget {
const LinkView({
@ -74,13 +75,13 @@ class LinkView extends StatelessWidget {
final TextStyle _titleFontSize = titleTextStyle ??
TextStyle(
fontSize: computeTitleFontSize(layoutWidth),
color: Colors.black,
color: Palette.black,
fontWeight: FontWeight.bold,
);
final TextStyle _bodyFontSize = bodyTextStyle ??
TextStyle(
fontSize: computeTitleFontSize(layoutWidth) - 1,
color: Colors.grey,
color: Palette.grey,
fontWeight: FontWeight.w400,
);

View File

@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/cubits/cubits.dart';
import 'package:hacki/screens/widgets/link_preview/web_analyzer.dart';
import 'package:hacki/styles/styles.dart';
class OfflineBanner extends StatelessWidget {
const OfflineBanner({
@ -25,7 +26,7 @@ class OfflineBanner extends StatelessWidget {
'${showExitButton ? 'Exit to fetch latest stories.' : ''}',
textAlign: showExitButton ? TextAlign.left : TextAlign.center,
),
backgroundColor: Colors.orangeAccent.withOpacity(0.3),
backgroundColor: Palette.orangeAccent.withOpacity(0.3),
actions: <Widget>[
if (showExitButton)
TextButton(
@ -46,7 +47,7 @@ class OfflineBanner extends StatelessWidget {
child: const Text(
'Yes',
style: TextStyle(
color: Colors.red,
color: Palette.red,
),
),
),

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:hacki/utils/utils.dart';
class OnboardingView extends StatefulWidget {
@ -16,34 +17,35 @@ class _OnboardingViewState extends State<OnboardingView> {
final Throttle throttle = Throttle(delay: _throttleDelay);
static const Duration _throttleDelay = Duration(milliseconds: 100);
static const double _screenshotHeight = 550;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).brightness == Brightness.light
? Colors.orange
? Palette.orange
: Theme.of(context).canvasColor,
elevation: 0,
elevation: Dimens.zero,
leading: IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
color: Palette.white,
),
onPressed: () => Navigator.pop(context),
),
),
backgroundColor: Theme.of(context).brightness == Brightness.light
? Colors.orange
? Palette.orange
: null,
body: Stack(
children: <Widget>[
Positioned(
top: 40,
left: 0,
right: 0,
top: Dimens.pt40,
left: Dimens.zero,
right: Dimens.zero,
child: SizedBox(
height: 550,
height: _screenshotHeight,
child: PageView(
controller: pageController,
scrollDirection: Axis.vertical,
@ -65,9 +67,9 @@ class _OnboardingViewState extends State<OnboardingView> {
),
),
Positioned(
bottom: 40,
left: 0,
right: 0,
bottom: Dimens.pt40,
left: Dimens.zero,
right: Dimens.zero,
child: ElevatedButton(
onPressed: () {
HapticFeedback.lightImpact();
@ -84,13 +86,15 @@ class _OnboardingViewState extends State<OnboardingView> {
},
style: ElevatedButton.styleFrom(
shape: const CircleBorder(),
primary: Colors.orange,
padding: const EdgeInsets.all(18),
primary: Palette.orange,
padding: const EdgeInsets.all(
Dimens.pt18,
),
),
child: const Icon(
Icons.arrow_drop_down_circle_outlined,
size: 24,
color: Colors.white,
size: TextDimens.pt24,
color: Palette.white,
),
),
),
@ -110,25 +114,27 @@ class _PageViewChild extends StatelessWidget {
final String path;
final String description;
static const double _height = 400;
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
SizedBox(
height: 400,
height: _height,
child: Image.asset(path),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 24,
vertical: 24,
horizontal: Dimens.pt24,
vertical: Dimens.pt24,
),
child: Text(
description,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 16,
color: Colors.white,
fontSize: TextDimens.pt16,
color: Palette.white,
),
),
),

View File

@ -5,6 +5,7 @@ import 'package:hacki/blocs/blocs.dart';
import 'package:hacki/config/constants.dart';
import 'package:hacki/models/models.dart';
import 'package:hacki/screens/widgets/widgets.dart';
import 'package:hacki/styles/styles.dart';
import 'package:shimmer/shimmer.dart';
class StoryTile extends StatelessWidget {
@ -28,18 +29,25 @@ class StoryTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (showWebPreview) {
const double screenWidthLowerBound = 428,
screenWidthUpperBound = 850,
picHeightLowerBound = 118,
picHeightUpperBound = 140,
smallPicHeight = 100,
picHeightFactor = 0.14;
final double screenWidth = MediaQuery.of(context).size.width;
final bool showSmallerPreviewPic =
screenWidth > 428.0 && screenWidth < 850;
final bool showSmallerPreviewPic = screenWidth > screenWidthLowerBound &&
screenWidth < screenWidthUpperBound;
final double height = showSmallerPreviewPic
? 100.0
: (MediaQuery.of(context).size.height * 0.14).clamp(118.0, 140.0);
? smallPicHeight
: (MediaQuery.of(context).size.height * picHeightFactor)
.clamp(picHeightLowerBound, picHeightUpperBound);
return TapDownWrapper(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
horizontal: Dimens.pt12,
),
child: AbsorbPointer(
child: LinkPreview(
@ -50,66 +58,77 @@ class StoryTile extends StatelessWidget {
child: SizedBox(
height: height,
child: Shimmer.fromColors(
baseColor: Colors.orange,
highlightColor: Colors.orangeAccent,
baseColor: Palette.orange,
highlightColor: Palette.orangeAccent,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
right: 5,
bottom: 5,
top: 5,
right: Dimens.pt5,
bottom: Dimens.pt5,
top: Dimens.pt5,
),
child: Container(
height: height,
width: height,
color: Colors.white,
color: Palette.white,
),
),
Expanded(
flex: 4,
child: Padding(
padding: const EdgeInsets.only(left: 4, top: 6),
padding: const EdgeInsets.only(
left: Dimens.pt4,
top: Dimens.pt6,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: double.infinity,
height: 14,
color: Colors.white,
height: Dimens.pt14,
color: Palette.white,
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 4),
padding: EdgeInsets.symmetric(
vertical: Dimens.pt4,
),
),
Container(
width: double.infinity,
height: 10,
color: Colors.white,
height: Dimens.pt10,
color: Palette.white,
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 3),
padding: EdgeInsets.symmetric(
vertical: Dimens.pt3,
),
),
Container(
width: double.infinity,
height: 10,
color: Colors.white,
height: Dimens.pt10,
color: Palette.white,
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 3),
padding: EdgeInsets.symmetric(
vertical: Dimens.pt3,
),
),
Container(
width: double.infinity,
height: 10,
color: Colors.white,
height: Dimens.pt10,
color: Palette.white,
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 3),
padding: EdgeInsets.symmetric(
vertical: Dimens.pt3,
),
),
Container(
width: 40,
height: 10,
color: Colors.white,
width: Dimens.pt40,
height: Dimens.pt10,
color: Palette.white,
),
],
),
@ -121,14 +140,14 @@ class StoryTile extends StatelessWidget {
),
),
errorImage: Constants.hackerNewsLogoLink,
backgroundColor: Colors.transparent,
borderRadius: 0,
backgroundColor: Palette.transparent,
borderRadius: Dimens.zero,
removeElevation: true,
bodyMaxLines: height == 100 ? 3 : 4,
bodyMaxLines: height == smallPicHeight ? 3 : 4,
errorTitle: story.title,
titleStyle: TextStyle(
color: hasRead
? Colors.grey[500]
? Palette.grey[500]
: Theme.of(context).textTheme.subtitle1!.color,
fontWeight: FontWeight.bold,
),
@ -141,12 +160,12 @@ class StoryTile extends StatelessWidget {
return InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.only(left: 12),
padding: const EdgeInsets.only(left: Dimens.pt12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(
height: 8,
height: Dimens.pt8,
),
Row(
children: <Widget>[
@ -154,7 +173,7 @@ class StoryTile extends StatelessWidget {
child: Text(
story.title,
style: TextStyle(
color: hasRead ? Colors.grey[500] : null,
color: hasRead ? Palette.grey[500] : null,
fontSize: simpleTileFontSize,
),
),
@ -168,7 +187,7 @@ class StoryTile extends StatelessWidget {
child: Text(
story.metadata,
style: TextStyle(
color: Colors.grey,
color: Palette.grey,
fontSize: simpleTileFontSize - 2,
),
maxLines: 1,
@ -177,7 +196,7 @@ class StoryTile extends StatelessWidget {
],
),
const SizedBox(
height: 8,
height: Dimens.pt8,
),
],
),

View File

@ -18,7 +18,6 @@ class _TapDownWrapperState extends State<TapDownWrapper>
with SingleTickerProviderStateMixin {
late AnimationController controller;
Tween<double> tween = Tween<double>(begin: 1, end: 0.95);
double scale = 1;
@override
void initState() {

38
lib/styles/dimens.dart Normal file
View File

@ -0,0 +1,38 @@
abstract class Dimens {
static const double zero = 0;
static const double pt2 = 2;
static const double pt3 = 3;
static const double pt4 = 4;
static const double pt5 = 5;
static const double pt6 = 6;
static const double pt8 = 8;
static const double pt10 = 10;
static const double pt12 = 12;
static const double pt14 = 14;
static const double pt16 = 16;
static const double pt18 = 18;
static const double pt20 = 20;
static const double pt24 = 24;
static const double pt36 = 36;
static const double pt40 = 40;
static const double pt48 = 48;
static const double pt50 = 50;
static const double pt64 = 64;
static const double pt100 = 100;
static const double pt120 = 120;
}
abstract class TextDimens {
static const double pt6 = 6;
static const double pt8 = 8;
static const double pt10 = 10;
static const double pt12 = 12;
static const double pt14 = 14;
static const double pt15 = 15;
static const double pt16 = 16;
static const double pt18 = 18;
static const double pt20 = 20;
static const double pt24 = 24;
static const double pt26 = 26;
static const double pt36 = 36;
}

21
lib/styles/palette.dart Normal file
View File

@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
abstract class Palette {
static const Color black = Colors.black;
static const Color black26 = Colors.black26;
static const Color white = Colors.white;
static const MaterialColor grey = Colors.grey;
static const MaterialColor orange = Colors.orange;
static const Color orangeAccent = Colors.orangeAccent;
static const MaterialColor deepOrange = Colors.deepOrange;
static const MaterialColor red = Colors.red;
static const Color transparent = Colors.transparent;
}

2
lib/styles/styles.dart Normal file
View File

@ -0,0 +1,2 @@
export 'dimens.dart';
export 'palette.dart';

View File

@ -6,6 +6,7 @@ import 'package:hacki/config/locator.dart';
import 'package:hacki/main.dart';
import 'package:hacki/repositories/repositories.dart';
import 'package:hacki/screens/screens.dart' show WebViewScreen;
import 'package:hacki/styles/styles.dart';
import 'package:url_launcher/url_launcher.dart';
abstract class LinkUtil {
@ -56,7 +57,7 @@ abstract class LinkUtil {
options: ChromeSafariBrowserClassOptions(
ios: IOSSafariOptions(
entersReaderIfAvailable: useReader,
preferredControlTintColor: Colors.orange,
preferredControlTintColor: Palette.orange,
),
),
)

View File

@ -7,7 +7,7 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "39.0.0"
version: "40.0.0"
adaptive_theme:
dependency: "direct main"
description:
@ -21,14 +21,14 @@ packages:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.1.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.3.1"
async:
dependency: transitive
description:
@ -42,7 +42,7 @@ packages:
name: badges
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.3"
bloc:
dependency: "direct main"
description:
@ -126,56 +126,56 @@ packages:
name: connectivity_plus
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.3.5"
connectivity_plus_linux:
dependency: transitive
description:
name: connectivity_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
connectivity_plus_macos:
dependency: transitive
description:
name: connectivity_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
version: "1.2.4"
connectivity_plus_platform_interface:
dependency: transitive
description:
name: connectivity_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
connectivity_plus_web:
dependency: transitive
description:
name: connectivity_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.2"
connectivity_plus_windows:
dependency: transitive
description:
name: connectivity_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.2"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.2"
coverage:
dependency: transitive
description:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.2"
crypto:
dependency: transitive
description:
@ -189,14 +189,14 @@ packages:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.1"
version: "0.17.2"
dbus:
dependency: transitive
description:
name: dbus
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.3"
version: "0.7.5"
diff_match_patch:
dependency: transitive
description:
@ -247,7 +247,7 @@ packages:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "2.0.1"
file:
dependency: transitive
description:
@ -273,7 +273,7 @@ packages:
name: flutter_blurhash
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.8"
version: "0.7.0"
flutter_cache_manager:
dependency: "direct main"
description:
@ -315,14 +315,14 @@ packages:
name: flutter_local_notifications
url: "https://pub.dartlang.org"
source: hosted
version: "9.5.2"
version: "9.6.1"
flutter_local_notifications_linux:
dependency: transitive
description:
name: flutter_local_notifications_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.2"
version: "0.5.0+1"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
@ -385,7 +385,7 @@ packages:
name: flutter_slidable
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
version: "1.3.0"
flutter_test:
dependency: "direct dev"
description: flutter
@ -409,7 +409,7 @@ packages:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
version: "2.1.3"
gbk_codec:
dependency: "direct main"
description:
@ -430,14 +430,14 @@ packages:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.1.0"
hive:
dependency: "direct main"
description:
name: hive
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.2.2"
html:
dependency: "direct main"
description:
@ -465,14 +465,14 @@ packages:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
version: "3.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.0.1"
intl:
dependency: "direct main"
description:
@ -577,14 +577,14 @@ packages:
name: octo_image
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.2"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.1.0"
path:
dependency: "direct main"
description:
@ -598,28 +598,28 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.10"
version: "2.0.11"
path_provider_android:
dependency: "direct main"
description:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.14"
version: "2.0.15"
path_provider_ios:
dependency: "direct main"
description:
name: path_provider_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
version: "2.0.10"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.6"
version: "2.1.7"
path_provider_macos:
dependency: transitive
description:
@ -640,7 +640,7 @@ packages:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
version: "2.1.0"
pedantic:
dependency: transitive
description:
@ -675,7 +675,7 @@ packages:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
version: "1.5.1"
process:
dependency: transitive
description:
@ -689,7 +689,7 @@ packages:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.2"
version: "6.0.3"
pub_semver:
dependency: transitive
description:
@ -733,21 +733,21 @@ packages:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.27.3"
version: "0.27.4"
sembast:
dependency: "direct main"
description:
name: sembast
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
version: "3.2.0+1"
share_plus:
dependency: "direct main"
description:
name: share_plus
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.8"
version: "4.0.9"
share_plus_linux:
dependency: transitive
description:
@ -845,28 +845,28 @@ packages:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.2"
shimmer:
dependency: "direct main"
description:
@ -997,7 +997,7 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
universal_platform:
dependency: "direct main"
description:
@ -1011,7 +1011,7 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.3"
version: "6.1.4"
url_launcher_android:
dependency: transitive
description:
@ -1025,7 +1025,7 @@ packages:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.16"
version: "6.0.17"
url_launcher_linux:
dependency: transitive
description:
@ -1046,14 +1046,14 @@ packages:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.1.0"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.0.12"
url_launcher_windows:
dependency: transitive
description:
@ -1144,7 +1144,7 @@ packages:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.1.0"
webview_flutter:
dependency: "direct main"
description:
@ -1158,28 +1158,28 @@ packages:
name: webview_flutter_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.8"
version: "2.8.14"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.9.1"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
url: "https://pub.dartlang.org"
source: hosted
version: "2.7.5"
version: "2.8.1"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.2"
version: "2.7.0"
workmanager:
dependency: "direct main"
description:
@ -1200,14 +1200,14 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.4.1"
version: "6.1.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
version: "3.1.1"
sdks:
dart: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"

View File

@ -1,6 +1,6 @@
name: hacki
description: A Hacker News reader.
version: 0.2.21+63
version: 0.2.22+64
publish_to: none
environment: