Skip to content

Commit

Permalink
Replace adwaita_icons with lucide_icon
Browse files Browse the repository at this point in the history
- Now window buttons are following native placements
  • Loading branch information
prateekmedia committed Oct 24, 2021
1 parent 94c9ced commit 064a602
Show file tree
Hide file tree
Showing 14 changed files with 168 additions and 302 deletions.
21 changes: 12 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/foundation.dart';

import 'package:adwaita_icons/adwaita_icons.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:lucide_icons/lucide_icons.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';

import 'utils/utils.dart';
Expand Down Expand Up @@ -193,9 +193,9 @@ class _HomePageState extends State<HomePage> {
: null,
leading: [
GtkHeaderButton(
icon: AdwaitaIcon(
!toggleSearch.value ? AdwaitaIcons.system_search : AdwaitaIcons.go_previous,
size: 17,
icon: Icon(
!toggleSearch.value ? LucideIcons.search : LucideIcons.chevronLeft,
size: 16,
),
onPressed: switchSearchBar,
),
Expand Down Expand Up @@ -276,7 +276,7 @@ class _HomePageState extends State<HomePage> {
Builder(builder: (context) {
return GtkHeaderButton(
isActive: isSidebarActive.value,
icon: const AdwaitaIcon(AdwaitaIcons.sidebar_toggle_left),
icon: const Icon(LucideIcons.sidebar, size: 17),
onPressed: () {
if (context.width < mobileWidth) {
Scaffold.of(context).openDrawer();
Expand Down Expand Up @@ -348,15 +348,15 @@ class _HomePageState extends State<HomePage> {
children: [
GtkSidebarItem(
label: "Explore",
leading: const AdwaitaIcon(AdwaitaIcons.explore2, size: 17),
leading: const Icon(LucideIcons.trendingUp, size: 17),
),
for (var category in (categories ?? {}).entries.toList().asMap().entries)
GtkSidebarItem(
label: category.value.key,
leading: AdwaitaIcon(
leading: Icon(
categoryIcons.containsKey(category.value.key)
? categoryIcons[category.value.key]!
: AdwaitaIcons.question,
: LucideIcons.helpCircle,
size: 19,
),
),
Expand Down Expand Up @@ -385,7 +385,10 @@ class _HomePageState extends State<HomePage> {
value: index,
onChanged: onChanged,
items: items,
icon: const Icon(Icons.arrow_drop_down),
icon: const Icon(
LucideIcons.chevronsUpDown,
size: 16,
),
underline: const SizedBox(),
),
),
Expand Down
8 changes: 2 additions & 6 deletions lib/screens/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:simple_html_css/simple_html_css.dart';
import 'package:cached_network_image/cached_network_image.dart';

Expand Down Expand Up @@ -42,9 +41,7 @@ class AppPage extends HookConsumerWidget {
imageUrl: app.iconUrl!,
fit: BoxFit.cover,
width: size,
placeholder: (c, b) => Center(
child: SpinKitRipple(color: context.textTheme.bodyText1!.color),
),
placeholder: (c, b) => const SizedBox(),
errorWidget: (c, w, i) => brokenImageWidget,
)
: SvgPicture.network(app.iconUrl!, width: size)
Expand Down Expand Up @@ -159,8 +156,7 @@ class AppPage extends HookConsumerWidget {
? SvgPicture.network(screenUrl)
: CachedNetworkImage(
imageUrl: screenUrl,
placeholder: (c, b) =>
Center(child: SpinKitRipple(color: context.textTheme.bodyText1!.color)),
placeholder: (c, b) => const SizedBox(),
errorWidget: (c, w, i) => brokenImageWidget,
)
: Container(),
Expand Down
199 changes: 58 additions & 141 deletions lib/screens/browse_view.dart

Large diffs are not rendered by default.

22 changes: 9 additions & 13 deletions lib/screens/downloads_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import 'dart:io';

import 'package:gtk/gtk.dart';
import 'package:flutter/material.dart';
import 'package:adwaita_icons/adwaita_icons.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

import 'package:appimagepool/utils/utils.dart';
import 'package:appimagepool/providers/providers.dart';
import 'package:lucide_icons/lucide_icons.dart';

class DownloadsView extends HookConsumerWidget {
final ValueNotifier<String> searchedTerm;
Expand All @@ -17,8 +17,7 @@ class DownloadsView extends HookConsumerWidget {
Widget build(context, ref) {
final listDownloads = ref
.watch(downloadListProvider)
.where((element) =>
element.name.toLowerCase().contains(searchedTerm.value))
.where((element) => element.name.toLowerCase().contains(searchedTerm.value))
.toList();
return listDownloads.isNotEmpty
? SingleChildScrollView(
Expand Down Expand Up @@ -49,8 +48,7 @@ class DownloadsView extends HookConsumerWidget {
),
const SizedBox(height: 3),
LinearProgressIndicator(
value:
i.totalBytes != 0 ? i.actualBytes / i.totalBytes : 0,
value: i.totalBytes != 0 ? i.actualBytes / i.totalBytes : 0,
minHeight: 10,
),
const SizedBox(height: 3),
Expand All @@ -69,20 +67,18 @@ class DownloadsView extends HookConsumerWidget {
),
trailing: IconButton(
onPressed: () {
if (i.cancelToken.isCancelled ||
(i.actualBytes == i.totalBytes && i.actualBytes != 0)) {
if (i.cancelToken.isCancelled || (i.actualBytes == i.totalBytes && i.actualBytes != 0)) {
removeItem();
} else if (i.actualBytes != i.totalBytes ||
i.actualBytes == 0) {
} else if (i.actualBytes != i.totalBytes || i.actualBytes == 0) {
i.cancelToken.cancel("cancelled");
ref.watch(downloadListProvider.notifier).refresh();
}
},
icon: AdwaitaIcon(i.cancelToken.isCancelled
? AdwaitaIcons.list_remove
icon: Icon(i.cancelToken.isCancelled
? LucideIcons.slash
: (i.actualBytes != i.totalBytes || i.actualBytes == 0)
? AdwaitaIcons.window_close
: AdwaitaIcons.user_trash),
? LucideIcons.x
: LucideIcons.trash),
),
onTap: (i.actualBytes == i.totalBytes && i.totalBytes != 0)
? () => runProgram(
Expand Down
9 changes: 3 additions & 6 deletions lib/screens/installed_view.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'dart:io';

import 'package:gtk/gtk.dart';
import 'package:lucide_icons/lucide_icons.dart';
import 'package:path/path.dart' as path;
import 'package:flutter/material.dart';
import 'package:adwaita_icons/adwaita_icons.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'package:appimagepool/utils/utils.dart';
Expand All @@ -25,10 +25,7 @@ class _InstalledViewState extends ConsumerState<InstalledView> {
final listInstalled = Directory(downloadPath)
.listSync()
.where((element) => element.path.endsWith('.AppImage'))
.where((element) => path
.basename(element.path)
.toLowerCase()
.contains(widget.searchedTerm.value))
.where((element) => path.basename(element.path).toLowerCase().contains(widget.searchedTerm.value))
.toList();
return listInstalled.isNotEmpty
? SingleChildScrollView(
Expand Down Expand Up @@ -57,7 +54,7 @@ class _InstalledViewState extends ConsumerState<InstalledView> {
subtitle: Text(i.statSync().size.getFileSize()),
trailing: IconButton(
onPressed: removeItem,
icon: const AdwaitaIcon(AdwaitaIcons.user_trash),
icon: const Icon(LucideIcons.trash),
),
onTap: () => runProgram(
location: path.dirname(i.path),
Expand Down
32 changes: 16 additions & 16 deletions lib/utils/constants.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:adwaita_icons/adwaita_icons.dart';
import 'package:lucide_icons/lucide_icons.dart';
import 'package:flutter/material.dart';
import 'utils.dart';

Expand All @@ -18,19 +18,19 @@ TextStyle linkStyle(BuildContext context, [bool showUnderline = true]) => TextSt
);

const mobileWidth = 800;

Widget brokenImageWidget = const AdwaitaIcon(AdwaitaIcons.question);
const Map<String, String> categoryIcons = {
'Video': AdwaitaIcons.video_x_generic,
'Audio': AdwaitaIcons.audio_headphones,
'Science': AdwaitaIcons.applications_science,
'System': AdwaitaIcons.applications_system,
'Utility': AdwaitaIcons.applications_utilities,
'Network': AdwaitaIcons.network_cellular,
'Development': AdwaitaIcons.applications_engineering,
'Education': AdwaitaIcons.note,
'Graphics': AdwaitaIcons.applications_graphics,
'Office': AdwaitaIcons.x_office_document,
'Game': AdwaitaIcons.applications_games,
'Finance': AdwaitaIcons.money,
Widget brokenImageWidget = const Icon(LucideIcons.helpCircle);

const Map<String, IconData> categoryIcons = {
'Video': LucideIcons.video,
'Audio': LucideIcons.headphones,
'Science': LucideIcons.flaskConical,
'System': LucideIcons.monitor,
'Utility': LucideIcons.gauge,
'Network': LucideIcons.barChart,
'Development': LucideIcons.code2,
'Education': LucideIcons.graduationCap,
'Graphics': LucideIcons.album,
'Office': LucideIcons.printer,
'Game': LucideIcons.gamepad2,
'Finance': LucideIcons.currency,
};
22 changes: 11 additions & 11 deletions lib/widgets/carousel_arrow.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:adwaita_icons/adwaita_icons.dart';
import 'package:appimagepool/utils/extensions.dart';
import 'package:flutter/material.dart';
import 'package:gtk/gtk.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

import 'package:appimagepool/utils/extensions.dart';

class CarouselArrow extends ConsumerWidget {
const CarouselArrow({
Key? key,
Expand All @@ -12,20 +12,20 @@ class CarouselArrow extends ConsumerWidget {
}) : super(key: key);

final VoidCallback onPressed;
final String icon;
final IconData icon;

@override
Widget build(context, ref) {
return SizedBox(
width: 44,
height: 44,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: GnomeTheme.of(context).sidebars.withOpacity(0.70),
return GestureDetector(
onTap: onPressed,
child: Container(
width: 44,
height: 44,
decoration: ShapeDecoration(
shape: const CircleBorder(),
color: GnomeTheme.of(context).sidebars.withOpacity(0.70),
),
child: AdwaitaIcon(icon, color: context.textTheme.bodyText1!.color, size: 30),
onPressed: onPressed,
child: Center(child: Icon(icon, color: context.textTheme.bodyText1!.color, size: 30)),
),
);
}
Expand Down
5 changes: 5 additions & 0 deletions lib/widgets/customdialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';

import 'package:appimagepool/utils/utils.dart';
import 'package:appimagepool/models/models.dart';
import 'package:lucide_icons/lucide_icons.dart';

class CustomDialogBox extends HookConsumerWidget {
final Widget img, endText;
Expand Down Expand Up @@ -58,6 +59,10 @@ class CustomDialogBox extends HookConsumerWidget {
isExpanded: true,
value: selectedIndex.value,
underline: Container(),
icon: const Icon(
LucideIcons.chevronsUpDown,
size: 16,
),
onChanged: (val) {
selectedIndex.value = val!;
if (onVersionChange != null) onVersionChange!(val);
Expand Down
16 changes: 8 additions & 8 deletions lib/widgets/download_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import 'dart:io';

import 'package:gtk/gtk.dart';
import 'package:flutter/material.dart';
import 'package:adwaita_icons/adwaita_icons.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

import 'package:appimagepool/utils/utils.dart';
import 'package:appimagepool/models/models.dart';
import 'package:appimagepool/providers/providers.dart';
import 'package:lucide_icons/lucide_icons.dart';

class DownloadButton extends HookConsumerWidget {
const DownloadButton({Key? key}) : super(key: key);

@override
Widget build(BuildContext context, ref) {
var downloading = ref.watch(isDownloadingProvider);
int downloading = ref.watch(isDownloadingProvider);
List<QueryApp> listDownloads = ref.watch(downloadListProvider);
return Hero(
tag: 'download_menu',
Expand All @@ -24,8 +24,8 @@ class DownloadButton extends HookConsumerWidget {
type: MaterialType.transparency,
child: GtkPopupMenu(
popupWidth: 400,
icon: AdwaitaIcon(
downloading > 0 ? AdwaitaIcons.folder_download : AdwaitaIcons.emblem_default,
icon: Icon(
downloading > 0 ? LucideIcons.download : LucideIcons.check,
size: 17,
),
body: Consumer(
Expand Down Expand Up @@ -74,11 +74,11 @@ class DownloadButton extends HookConsumerWidget {
ref.watch(downloadListProvider.notifier).refresh();
}
},
icon: AdwaitaIcon(i.cancelToken.isCancelled
? AdwaitaIcons.list_remove
icon: Icon(i.cancelToken.isCancelled
? LucideIcons.xCircle
: (i.actualBytes != i.totalBytes || i.actualBytes == 0)
? AdwaitaIcons.window_close
: AdwaitaIcons.user_trash),
? LucideIcons.x
: LucideIcons.trash),
),
onTap: (i.actualBytes == i.totalBytes && i.totalBytes != 0)
? () => runProgram(
Expand Down
Loading

0 comments on commit 064a602

Please sign in to comment.