Enable prefer_single_quotes rule in formatter

This commit is contained in:
John Wesley 2024-05-31 12:52:10 -04:00
parent dd6196f473
commit 491edf7ea6
22 changed files with 110 additions and 118 deletions

View File

@ -22,7 +22,7 @@ linter:
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@ -148,7 +148,7 @@ class APIComments {
final response = await httpClient.get(Uri.https(server, path, query));
httpErrorHandler(response, message: "Failed to load user");
httpErrorHandler(response, message: 'Failed to load user');
final json = jsonDecode(response.body) as Map<String, Object?>;
@ -302,7 +302,7 @@ class APIComments {
}),
);
httpErrorHandler(response, message: "Failed to edit comment");
httpErrorHandler(response, message: 'Failed to edit comment');
return CommentModel.fromMbin(
jsonDecode(response.body) as Map<String, Object?>);
@ -319,7 +319,7 @@ class APIComments {
}),
);
httpErrorHandler(response, message: "Failed to edit comment");
httpErrorHandler(response, message: 'Failed to edit comment');
return CommentModel.fromLemmy(
jsonDecode(response.body)['comment_view'] as Map<String, Object?>);
@ -333,7 +333,7 @@ class APIComments {
final response = await httpClient.delete(Uri.https(server, path));
httpErrorHandler(response, message: "Failed to delete comment");
httpErrorHandler(response, message: 'Failed to delete comment');
case ServerSoftware.lemmy:
const path = '/api/v3/comment/delete';
@ -347,7 +347,7 @@ class APIComments {
}),
);
httpErrorHandler(response, message: "Failed to delete comment");
httpErrorHandler(response, message: 'Failed to delete comment');
}
}
@ -363,7 +363,7 @@ class APIComments {
}),
);
httpErrorHandler(response, message: "Failed to report comment");
httpErrorHandler(response, message: 'Failed to report comment');
case ServerSoftware.lemmy:
const path = '/api/v3/comment/report';
@ -377,7 +377,7 @@ class APIComments {
}),
);
httpErrorHandler(response, message: "Failed to report comment");
httpErrorHandler(response, message: 'Failed to report comment');
}
}
}

View File

@ -101,7 +101,7 @@ class MbinAPIMicroblogs {
body: jsonEncode({'body': body, 'lang': lang, 'isAdult': isAdult}),
);
httpErrorHandler(response, message: "Failed to edit post");
httpErrorHandler(response, message: 'Failed to edit post');
return PostModel.fromMbinPost(
jsonDecode(response.body) as Map<String, Object?>);
@ -114,7 +114,7 @@ class MbinAPIMicroblogs {
final response = await httpClient.delete(Uri.https(server, path));
httpErrorHandler(response, message: "Failed to delete post");
httpErrorHandler(response, message: 'Failed to delete post');
}
Future<PostModel> create(
@ -128,7 +128,7 @@ class MbinAPIMicroblogs {
final response = await httpClient.post(Uri.https(server, path),
body: jsonEncode({'body': body, 'lang': lang, 'isAdult': isAdult}));
httpErrorHandler(response, message: "Failed to create post");
httpErrorHandler(response, message: 'Failed to create post');
return PostModel.fromMbinPost(
jsonDecode(response.body) as Map<String, Object?>);
@ -160,7 +160,7 @@ class MbinAPIMicroblogs {
var response =
await http.Response.fromStream(await httpClient.send(request));
httpErrorHandler(response, message: "Failed to create post");
httpErrorHandler(response, message: 'Failed to create post');
return PostModel.fromMbinPost(
jsonDecode(response.body) as Map<String, Object?>);
@ -176,6 +176,6 @@ class MbinAPIMicroblogs {
}),
);
httpErrorHandler(response, message: "Failed to report post");
httpErrorHandler(response, message: 'Failed to report post');
}
}

View File

@ -88,7 +88,7 @@ class APIThreads {
final response = await httpClient.get(Uri.https(server, path, query));
httpErrorHandler(response, message: "Failed to load user");
httpErrorHandler(response, message: 'Failed to load user');
final json = jsonDecode(response.body) as Map<String, Object?>;
@ -224,7 +224,7 @@ class APIThreads {
}),
);
httpErrorHandler(response, message: "Failed to edit entry");
httpErrorHandler(response, message: 'Failed to edit entry');
return PostModel.fromMbinEntry(
jsonDecode(response.body) as Map<String, Object?>);
@ -256,7 +256,7 @@ class APIThreads {
final response =
await httpClient.delete(Uri.https(server, '/api/entry/$postID'));
httpErrorHandler(response, message: "Failed to delete entry");
httpErrorHandler(response, message: 'Failed to delete entry');
break;
case ServerSoftware.lemmy:
@ -266,7 +266,7 @@ class APIThreads {
body: jsonEncode({'post_id': postID, 'deleted': true}),
);
httpErrorHandler(response, message: "Failed to delete entry");
httpErrorHandler(response, message: 'Failed to delete entry');
break;
}
}
@ -296,7 +296,7 @@ class APIThreads {
}),
);
httpErrorHandler(response, message: "Failed to create entry");
httpErrorHandler(response, message: 'Failed to create entry');
return PostModel.fromMbinEntry(
jsonDecode(response.body) as Map<String, Object?>);
@ -348,7 +348,7 @@ class APIThreads {
}),
);
httpErrorHandler(response, message: "Failed to create entry");
httpErrorHandler(response, message: 'Failed to create entry');
return PostModel.fromMbinEntry(
jsonDecode(response.body) as Map<String, Object?>);
@ -409,7 +409,7 @@ class APIThreads {
var response =
await http.Response.fromStream(await httpClient.send(request));
httpErrorHandler(response, message: "Failed to create entry");
httpErrorHandler(response, message: 'Failed to create entry');
return PostModel.fromMbinEntry(
jsonDecode(response.body) as Map<String, Object?>);
@ -429,7 +429,7 @@ class APIThreads {
var pictrsResponse =
await http.Response.fromStream(await httpClient.send(request));
httpErrorHandler(pictrsResponse, message: "Failed to upload image");
httpErrorHandler(pictrsResponse, message: 'Failed to upload image');
final json = jsonDecode(pictrsResponse.body) as Map<String, Object?>;
@ -468,7 +468,7 @@ class APIThreads {
}),
);
httpErrorHandler(response, message: "Failed to report post");
httpErrorHandler(response, message: 'Failed to report post');
case ServerSoftware.lemmy:
const path = '/api/v3/post/report';
@ -482,7 +482,7 @@ class APIThreads {
}),
);
httpErrorHandler(response, message: "Failed to report post");
httpErrorHandler(response, message: 'Failed to report post');
}
}
}

View File

@ -67,7 +67,7 @@ class APIUsers {
final response = await httpClient.get(Uri.https(server, path, query));
httpErrorHandler(response, message: "Failed to load user");
httpErrorHandler(response, message: 'Failed to load user');
return DetailedUserModel.fromLemmy(
jsonDecode(response.body) as Map<String, Object?>);
@ -95,7 +95,7 @@ class APIUsers {
final response = await httpClient.get(Uri.https(server, path, query));
httpErrorHandler(response, message: "Failed to load user");
httpErrorHandler(response, message: 'Failed to load user');
return DetailedUserModel.fromLemmy(
jsonDecode(response.body) as Map<String, Object?>);
@ -166,7 +166,7 @@ class APIUsers {
headers: {'Content-Type': 'application/json'},
body: jsonEncode({'bio': about}));
httpErrorHandler(response, message: "Failed to load user");
httpErrorHandler(response, message: 'Failed to load user');
return null;
}
@ -199,7 +199,7 @@ class APIUsers {
}),
);
httpErrorHandler(response, message: "Failed to send block");
httpErrorHandler(response, message: 'Failed to send block');
return DetailedUserModel.fromLemmy(
jsonDecode(response.body) as Map<String, Object?>);
@ -259,7 +259,7 @@ class APIUsers {
}),
);
httpErrorHandler(response, message: "Failed to update avatar");
httpErrorHandler(response, message: 'Failed to update avatar');
return null;
}
@ -332,7 +332,7 @@ class APIUsers {
'banner': 'https://$server/pictrs/image/$imageName',
}));
httpErrorHandler(response, message: "Failed to update cover");
httpErrorHandler(response, message: 'Failed to update cover');
return null;
}

View File

@ -86,7 +86,7 @@ class _CreateScreenState extends State<CreateScreen> {
magazineId,
title: _titleTextController.text,
image: _imageFile!,
alt: "",
alt: '',
isOc: _isOc,
body: _bodyTextController.text,
lang: _lang,
@ -118,7 +118,7 @@ class _CreateScreenState extends State<CreateScreen> {
await api.microblogs.createImage(
magazineId,
image: _imageFile!,
alt: "",
alt: '',
body: _bodyTextController.text,
lang: _lang,
isAdult: _isAdult,
@ -145,7 +145,7 @@ class _CreateScreenState extends State<CreateScreen> {
padding: const EdgeInsets.all(5),
child: TextEditor(
_titleTextController,
label: "Title",
label: 'Title',
),
),
if (_imageFile == null || widget.type == PostType.microblog)
@ -167,7 +167,7 @@ class _CreateScreenState extends State<CreateScreen> {
child: TextEditor(
_urlTextController,
keyboardType: TextInputType.url,
label: "URL",
label: 'URL',
onChanged: (_) => setState(() {}),
),
),
@ -194,7 +194,7 @@ class _CreateScreenState extends State<CreateScreen> {
padding: const EdgeInsets.all(5),
child: TextEditor(
_tagsTextController,
label: "Tags",
label: 'Tags',
hint: 'Separate with spaces',
),
),

View File

@ -100,7 +100,7 @@ class _DomainScreenState extends State<DomainScreen> {
},
icon: const Icon(Icons.block),
style: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(
foregroundColor: WidgetStatePropertyAll(
_data!.isBlockedByUser == true
? Theme.of(context).colorScheme.error
: Theme.of(context).disabledColor),

View File

@ -22,7 +22,7 @@ class DomainsScreen extends StatefulWidget {
class _DomainsScreenState extends State<DomainsScreen> {
MbinAPIDomainsFilter filter = MbinAPIDomainsFilter.all;
String search = "";
String search = '';
final PagingController<String, DomainModel> _pagingController =
PagingController(firstPageKey: '');

View File

@ -139,7 +139,7 @@ class _MagazineScreenState extends State<MagazineScreen> {
},
icon: const Icon(Icons.block),
style: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(
foregroundColor: WidgetStatePropertyAll(
_data!.isBlockedByUser == true
? Theme.of(context).colorScheme.error
: Theme.of(context).disabledColor),

View File

@ -25,7 +25,7 @@ class MagazinesScreen extends StatefulWidget {
class _MagazinesScreenState extends State<MagazinesScreen> {
APIMagazinesFilter filter = APIMagazinesFilter.all;
APIMagazinesSort sort = APIMagazinesSort.hot;
String search = "";
String search = '';
final searchDebounce = Debouncer(duration: const Duration(milliseconds: 500));
final PagingController<String, DetailedMagazineModel> _pagingController =

View File

@ -29,7 +29,7 @@ class SearchScreen extends StatefulWidget {
}
class _SearchScreenState extends State<SearchScreen> {
String search = "";
String search = '';
final searchDebounce = Debouncer(duration: const Duration(milliseconds: 500));
final PagingController<String, dynamic> _pagingController =
@ -77,7 +77,7 @@ class _SearchScreenState extends State<SearchScreen> {
decoration: const InputDecoration(
contentPadding: EdgeInsets.all(12),
border: OutlineInputBorder(),
label: Text("Search"),
label: Text('Search'),
),
),
),
@ -129,7 +129,7 @@ class _SearchScreenState extends State<SearchScreen> {
case CommentModel item:
return PostCommentScreen(item.postType, item.id);
case _:
throw "Unrecognized search item";
throw 'Unrecognized search item';
}
}),
);
@ -243,7 +243,7 @@ class _SearchScreenState extends State<SearchScreen> {
),
]),
),
_ => const Text("Unknown"),
_ => const Text('Unknown'),
},
);
}),

View File

@ -174,7 +174,7 @@ class _UserScreenState extends State<UserScreen> {
});
});
})),
child: const Text("Edit"),
child: const Text('Edit'),
),
),
)
@ -260,7 +260,7 @@ class _UserScreenState extends State<UserScreen> {
},
icon: const Icon(Icons.block),
style: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(
foregroundColor: WidgetStatePropertyAll(
user.isBlockedByUser == true
? Theme.of(context).colorScheme.error
: Theme.of(context).disabledColor),

View File

@ -21,7 +21,7 @@ class MessageItem extends StatelessWidget {
context
.watch<SettingsController>()
.selectedAccount
.split("@")
.split('@')
.first)
.first;

View File

@ -47,7 +47,7 @@ class _MessageThreadScreenState extends State<MessageThreadScreen> {
context
.watch<SettingsController>()
.selectedAccount
.split("@")
.split('@')
.first)
.first;

View File

@ -172,7 +172,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
]),
Row(
children: [
const Text("Select Avatar"),
const Text('Select Avatar'),
Padding(
padding: const EdgeInsets.all(12),
child: ImageSelector(
@ -187,13 +187,13 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
_deleteAvatar = true;
});
},
child: const Text("Delete"),
child: const Text('Delete'),
)
],
),
Row(
children: [
const Text("Select Cover"),
const Text('Select Cover'),
Padding(
padding: const EdgeInsets.all(12),
child: ImageSelector(
@ -209,7 +209,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
_deleteCover = true;
});
},
child: const Text("Delete"),
child: const Text('Delete'),
)
],
),
@ -217,7 +217,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
padding: const EdgeInsets.only(top: 12),
child: MarkdownEditor(
_aboutTextController!,
label: "About",
label: 'About',
),
),
if (_settings != null)
@ -227,11 +227,11 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Settings",
'Settings',
style: Theme.of(context).textTheme.titleLarge,
),
SwitchListTile(
title: const Text("Show NSFW"),
title: const Text('Show NSFW'),
value: _settings!.showNSFW,
onChanged: (bool value) {
setState(() {
@ -242,7 +242,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
),
if (_settings!.blurNSFW != null)
SwitchListTile(
title: const Text("Blur NSFW"),
title: const Text('Blur NSFW'),
value: _settings!.blurNSFW!,
onChanged: (bool? value) {
setState(() {
@ -253,7 +253,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
),
if (_settings!.showReadPosts != null)
SwitchListTile(
title: const Text("Show read posts"),
title: const Text('Show read posts'),
value: _settings!.showReadPosts!,
onChanged: (bool? value) {
setState(() {
@ -264,7 +264,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
),
if (_settings!.showSubscribedUsers != null)
SwitchListTile(
title: const Text("Show subscribed users"),
title: const Text('Show subscribed users'),
value: _settings!.showSubscribedUsers!,
onChanged: (bool? value) {
setState(() {
@ -275,7 +275,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
),
if (_settings!.showSubscribedMagazines != null)
SwitchListTile(
title: const Text("Show subscribed magazines"),
title: const Text('Show subscribed magazines'),
value: _settings!.showSubscribedMagazines!,
onChanged: (bool? value) {
setState(() {
@ -286,7 +286,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
),
if (_settings!.showSubscribedDomains != null)
SwitchListTile(
title: const Text("Show subscribed domains"),
title: const Text('Show subscribed domains'),
value: _settings!.showSubscribedDomains!,
onChanged: (bool? value) {
setState(() {
@ -297,7 +297,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
),
if (_settings!.showProfileSubscriptions != null)
SwitchListTile(
title: const Text("Show profile subscriptions"),
title: const Text('Show profile subscriptions'),
value: _settings!.showProfileSubscriptions!,
onChanged: (bool? value) {
setState(() {
@ -308,7 +308,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
),
if (_settings!.showProfileFollowings != null)
SwitchListTile(
title: const Text("Show profile followings"),
title: const Text('Show profile followings'),
value: _settings!.showProfileFollowings!,
onChanged: (bool? value) {
setState(() {
@ -320,7 +320,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
if (_settings!.notifyOnNewEntry != null)
SwitchListTile(
title: const Text(
"Notify on new threads in subscribed magazines"),
'Notify on new threads in subscribed magazines'),
value: _settings!.notifyOnNewEntry!,
onChanged: (bool? value) {
setState(() {
@ -332,7 +332,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
if (_settings!.notifyOnNewPost != null)
SwitchListTile(
title: const Text(
"Notify on new microblog in subscribed magazines"),
'Notify on new microblog in subscribed magazines'),
value: _settings!.notifyOnNewPost!,
onChanged: (bool? value) {
setState(() {
@ -344,7 +344,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
if (_settings!.notifyOnNewEntryReply != null)
SwitchListTile(
title: const Text(
"Notify on comments in authored threads"),
'Notify on comments in authored threads'),
value: _settings!.notifyOnNewEntryReply!,
onChanged: (bool? value) {
setState(() {
@ -356,7 +356,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
if (_settings!.notifyOnNewEntryCommentReply != null)
SwitchListTile(
title:
const Text("Notify on thread comment reply"),
const Text('Notify on thread comment reply'),
value: _settings!.notifyOnNewEntryCommentReply!,
onChanged: (bool? value) {
setState(() {
@ -369,7 +369,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
if (_settings!.notifyOnNewPostReply != null)
SwitchListTile(
title: const Text(
"Notify on comments in authored microposts"),
'Notify on comments in authored microblogs'),
value: _settings!.notifyOnNewPostReply!,
onChanged: (bool? value) {
setState(() {
@ -381,7 +381,7 @@ class _ProfileEditScreen extends State<ProfileEditScreen> {
if (_settings!.notifyOnNewPostCommentReply != null)
SwitchListTile(
title: const Text(
"Notify on microblog comment reply"),
'Notify on microblog comment reply'),
value: _settings!.notifyOnNewPostCommentReply!,
onChanged: (bool? value) {
setState(() {

View File

@ -305,7 +305,7 @@ const SelectionMenu<ThemeMode> themeModeSelect = SelectionMenu(
);
SelectionMenu<String> themeSelect = SelectionMenu(
"Theme Accent Color",
'Theme Accent Color',
themes
.map((themeInfo) => SelectionMenuItem(
value: themeInfo.name,

View File

@ -141,60 +141,60 @@ class SettingsController with ChangeNotifier {
_themeMode = parseEnum(
ThemeMode.values,
ThemeMode.system,
prefs.getString("themeMode"),
prefs.getString('themeMode'),
);
_useDynamicColor = prefs.getBool("useDynamicColor") ?? true;
_accentColor = prefs.getString("accentColor") ?? "Default";
_useDynamicColor = prefs.getBool('useDynamicColor') ?? true;
_accentColor = prefs.getString('accentColor') ?? 'Default';
_alwaysShowInstance = prefs.getBool("alwaysShowInstance") ?? false;
_alwaysShowInstance = prefs.getBool('alwaysShowInstance') ?? false;
_postImagePosition = parseEnum(
PostImagePosition.values,
PostImagePosition.auto,
prefs.getString("postImagePosition"),
prefs.getString('postImagePosition'),
);
_postCompactPreview = prefs.getBool("postCompactPreview") ?? false;
_postCompactPreview = prefs.getBool('postCompactPreview') ?? false;
_feedActionBackToTop = parseEnum(
ActionLocation.values,
ActionLocation.fabMenu,
prefs.getString("feedActionBackToTop"),
prefs.getString('feedActionBackToTop'),
);
_feedActionCreatePost = parseEnum(
ActionLocation.values,
ActionLocation.fabMenu,
prefs.getString("feedActionCreatePost"),
prefs.getString('feedActionCreatePost'),
);
_feedActionExpandFab = parseEnum(
ActionLocation.values,
ActionLocation.fabTap,
prefs.getString("feedActionExpandFab"),
prefs.getString('feedActionExpandFab'),
);
_feedActionRefresh = parseEnum(
ActionLocation.values,
ActionLocation.fabMenu,
prefs.getString("feedActionRefresh"),
prefs.getString('feedActionRefresh'),
);
_feedActionSetFilter = parseEnum(
ActionLocationWithTabs.values,
ActionLocationWithTabs.tabs,
prefs.getString("feedActionSetFilter"),
prefs.getString('feedActionSetFilter'),
);
_feedActionSetSort = parseEnum(
ActionLocation.values,
ActionLocation.appBar,
prefs.getString("feedActionSetSort"),
prefs.getString('feedActionSetSort'),
);
_feedActionSetType = parseEnum(
ActionLocationWithTabs.values,
ActionLocationWithTabs.appBar,
prefs.getString("feedActionSetType"),
prefs.getString('feedActionSetType'),
);
_defaultFeedType = parseEnum(
PostType.values,
PostType.thread,
prefs.getString("defaultFeedType"),
prefs.getString('defaultFeedType'),
);
_defaultEntriesFeedSort = parseEnum(
FeedSort.values,
@ -214,14 +214,14 @@ class SettingsController with ChangeNotifier {
_defaultCommentSort = parseEnum(
CommentSort.values,
CommentSort.hot,
prefs.getString("defaultCommentSort"),
prefs.getString('defaultCommentSort'),
);
_useAccountLangFilter = prefs.getBool("useAccountLangFilter") ?? true;
_langFilter = prefs.getStringList("langFilter")?.toSet() ?? {};
_defaultCreateLang = prefs.getString("defaultCreateLang") ?? 'en';
_useAccountLangFilter = prefs.getBool('useAccountLangFilter') ?? true;
_langFilter = prefs.getStringList('langFilter')?.toSet() ?? {};
_defaultCreateLang = prefs.getString('defaultCreateLang') ?? 'en';
_stars = prefs.getStringList("stars")?.toSet() ?? {};
_stars = prefs.getStringList('stars')?.toSet() ?? {};
_feedFilters = prefs.getStringList('feedFilters')?.toSet() ?? {};
_regenerateFeedFiltersRegExp();

View File

@ -22,11 +22,9 @@ class ThemeInfo {
onError: Color(0xFFFFFFFF),
errorContainer: Color(0xFFF9DEDC),
onErrorContainer: Color(0xFF410E0B),
background: Color(0xFFFFFBFE),
onBackground: Color(0xFF1C1B1F),
surface: Color(0xFFFFFBFE),
onSurface: Color(0xFF1C1B1F),
surfaceVariant: Color(0xFFE7E0EC),
surfaceContainerHighest: Color(0xFFE7E0EC),
onSurfaceVariant: Color(0xFF49454F),
outline: Color(0xFF79747E),
outlineVariant: Color(0xFFCAC4D0),
@ -56,11 +54,9 @@ class ThemeInfo {
onError: Color(0xFF601410),
errorContainer: Color(0xFF8C1D18),
onErrorContainer: Color(0xFFF9DEDC),
background: Color(0xFF1C1B1F),
onBackground: Color(0xFFE6E1E5),
surface: Color(0xFF1C1B1F),
onSurface: Color(0xFFE6E1E5),
surfaceVariant: Color(0xFF49454F),
surfaceContainerHighest: Color(0xFF49454F),
onSurfaceVariant: Color(0xFFCAC4D0),
outline: Color(0xFF938F99),
outlineVariant: Color(0xFF49454F),
@ -75,8 +71,8 @@ class ThemeInfo {
}
final List<ThemeInfo> themes = [
ThemeInfo("Default"),
ThemeInfo("Catppuccin",
ThemeInfo('Default'),
ThemeInfo('Cappuccino',
lightMode: const ColorScheme(
brightness: Brightness.light,
primary: Color(0xFFDCE0E8),
@ -85,8 +81,6 @@ final List<ThemeInfo> themes = [
onSecondary: Color(0xFFEA76CB),
error: Color(0xFFACB0BE),
onError: Color(0xFFD20F39),
background: Color(0xFFEFF1F5),
onBackground: Color(0xFF4C4F69),
surface: Color(0xFFCCD0DA),
onSurface: Color(0xFF4C4F69),
),
@ -98,13 +92,11 @@ final List<ThemeInfo> themes = [
onSecondary: Color(0xFFF5C2E7),
error: Color(0xFF585B70),
onError: Color(0xFFF38BA8),
background: Color(0xFF1E1E2E),
onBackground: Color(0xFFCDD6F4),
surface: Color(0xFF313244),
onSurface: Color(0xFFCDD6F4),
)),
ThemeInfo(
"Blue",
'Blue',
lightMode: ColorScheme.fromSwatch(
primarySwatch: Colors.blue, backgroundColor: const Color(0xFFFFFBFE)),
darkMode: ColorScheme.fromSwatch(
@ -114,7 +106,7 @@ final List<ThemeInfo> themes = [
),
),
ThemeInfo(
"Purple",
'Purple',
lightMode: ColorScheme.fromSwatch(
primarySwatch: Colors.purple,
),
@ -124,7 +116,7 @@ final List<ThemeInfo> themes = [
),
),
ThemeInfo(
"Red",
'Red',
lightMode: ColorScheme.fromSwatch(
primarySwatch: Colors.red,
),
@ -134,7 +126,7 @@ final List<ThemeInfo> themes = [
),
),
ThemeInfo(
"Amber",
'Amber',
lightMode: ColorScheme.fromSwatch(
primarySwatch: Colors.amber,
),

View File

@ -17,35 +17,35 @@ String timeDiffFormat(DateTime input) {
if (difference.inDays > 0) {
var years = (difference.inDays / 365).truncate();
if (years >= 1) {
return "${years}Y";
return '${years}Y';
}
var months = (difference.inDays / 30).truncate();
if (months >= 1) {
return "${months}M";
return '${months}M';
}
var weeks = (difference.inDays / 7).truncate();
if (weeks >= 1) {
return "${weeks}w";
return '${weeks}w';
}
var days = difference.inDays;
return "${days}d";
return '${days}d';
}
var hours = difference.inHours;
if (hours > 0) {
return "${hours}h";
return '${hours}h';
}
var minutes = difference.inMinutes;
if (minutes > 0) {
return "${minutes}m";
return '${minutes}m';
}
var seconds = difference.inSeconds;
return "${seconds}s";
return '${seconds}s';
}
void httpErrorHandler(http.Response response, {String? message}) {
@ -84,7 +84,7 @@ T? whenLoggedIn<T>(
context
.read<SettingsController>()
.selectedAccount
.split("@")
.split('@')
.first ==
matchesUsername)
? value

View File

@ -476,7 +476,7 @@ class _ContentItemState extends State<ContentItem> {
context, widget.openLinkUri!),
child: const Padding(
padding: EdgeInsets.all(12),
child: Text("Open Link")),
child: Text('Open Link')),
),
if (widget.onReport != null)
MenuItemButton(
@ -491,7 +491,7 @@ class _ContentItemState extends State<ContentItem> {
},
child: const Padding(
padding: EdgeInsets.all(12),
child: Text("Report")),
child: Text('Report')),
),
if (widget.onEdit != null)
MenuItemButton(
@ -502,7 +502,7 @@ class _ContentItemState extends State<ContentItem> {
}),
child: const Padding(
padding: EdgeInsets.all(12),
child: Text("Edit")),
child: Text('Edit')),
),
if (widget.onDelete != null)
MenuItemButton(
@ -536,7 +536,7 @@ class _ContentItemState extends State<ContentItem> {
),
child: const Padding(
padding: EdgeInsets.all(12),
child: Text("Delete")),
child: Text('Delete')),
),
],
),

View File

@ -7,7 +7,7 @@ class SubscriptMarkdownSyntax extends md.InlineSyntax {
@override
bool onMatch(md.InlineParser parser, Match match) {
parser.addNode(md.Element.text("sub", match[1]!));
parser.addNode(md.Element.text('sub', match[1]!));
return true;
}
}
@ -17,7 +17,7 @@ class SuperscriptMarkdownSyntax extends md.InlineSyntax {
@override
bool onMatch(md.InlineParser parser, Match match) {
parser.addNode(md.Element.text("sup", match[1]!));
parser.addNode(md.Element.text('sup', match[1]!));
return true;
}
}

View File

@ -26,9 +26,9 @@ class _RedirectListenerState extends State<RedirectListener> {
final req = await server.first;
final result = req.uri;
req.response.statusCode = 200;
req.response.headers.set("content-type", "text/plain");
req.response.headers.set('content-type', 'text/plain');
req.response.writeln(
"Redirect received. You can close this tab now and return to the app.");
'Redirect received. You can close this tab now and return to the app.');
await req.response.close();
await server.close();
return result;