Skip to content

About dialog/window rework #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
71 changes: 39 additions & 32 deletions example/lib/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:example/pages/about_dialog_page.dart';
import 'package:example/pages/avatar_page.dart';
import 'package:example/pages/counter_page.dart';
import 'package:example/pages/flap_page.dart';
Expand Down Expand Up @@ -114,38 +115,40 @@ class _MyHomePageState extends State<MyHomePage> {
top: 10,
bottom: 10,
),
onPressed: () => showDialog<Widget>(
context: context,
builder: (ctx) => AdwAboutWindow(
issueTrackerLink:
'https://github.com/gtk-flutter/libadwaita/issues',
appIcon: Image.asset('assets/logo.png'),
actions: AdwActions(
onClose: Navigator.of(context).pop,
onHeaderDrag: appWindow?.startDragging,
onDoubleTap: appWindow?.maximizeOrRestore,
),
credits: [
AdwPreferencesGroup.credits(
title: 'Developers',
children: developers.entries
.map(
(e) => AdwActionRow(
title: e.key,
onActivated: () => launchUrl(
Uri.parse('https://github.com/${e.value}'),
),
),
)
.toList(),
),
],
copyright: 'Copyright 2021-2022 Gtk-Flutter Developers',
license: const Text(
'GNU LGPL-3.0, This program comes with no warranty.',
),
),
),
onPressed: () {
// showDialog<Widget>(
// context: context,
// builder: (ctx) => AdwAboutWindow(
// issueTrackerLink:
// 'https://github.com/gtk-flutter/libadwaita/issues',
// appIcon: Image.asset('assets/logo.png'),
// actions: AdwActions(
// onClose: Navigator.of(context).pop,
// onHeaderDrag: appWindow?.startDragging,
// onDoubleTap: appWindow?.maximizeOrRestore,
// ),
// credits: [
// AdwPreferencesGroup.credits(
// title: 'Developers',
// children: developers.entries
// .map(
// (e) => AdwActionRow(
// title: e.key,
// onActivated: () => launchUrl(
// Uri.parse('https://github.com/${e.value}'),
// ),
// ),
// )
// .toList(),
// ),
// ],
// copyright: 'Copyright 2021-2022 Gtk-Flutter Developers',
// license: const Text(
// 'GNU LGPL-3.0, This program comes with no warranty.',
// ),
// ),
// );
},
child: const Text(
'About this Demo',
style: TextStyle(fontSize: 15),
Expand Down Expand Up @@ -182,6 +185,9 @@ class _MyHomePageState extends State<MyHomePage> {
),
AdwSidebarItem(
label: 'Style Classes',
),
AdwSidebarItem(
label: 'About Window',
)
],
onSelected: (index) => setState(() => _currentIndex = index),
Expand All @@ -198,6 +204,7 @@ class _MyHomePageState extends State<MyHomePage> {
const ViewSwitcherPage(),
const SettingsPage(),
const StyleClassesPage(),
const AboutDialogPage(),
],
),
);
Expand Down
73 changes: 73 additions & 0 deletions example/lib/pages/about_dialog_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import 'package:example/pages/run_demo_screen.dart';
import 'package:flutter/material.dart';
import 'package:libadwaita/libadwaita.dart';

class AboutDialogPage extends StatelessWidget {
const AboutDialogPage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return DemoScreen(
image: const Icon(
Icons.view_sidebar_rounded,
size: 130,
),
title: 'About Dialog',
description: 'Something something',
footer: AdwButton.pill(
child: const Text('Run the demo'),
onPressed: () {
showDialog<Widget>(
context: context,
builder: (context) => AdwAboutWindow(
supportUrl: 'https://example.org',
issueUrl: 'https://example.org',
developers: [
AboutWindowPerson(
name: 'Angela Avery',
url: 'mailto:[email protected]',
),
],
designers: [
AboutWindowPerson(
name: 'Ben Dover',
url: 'mailto:[email protected]',
),
],
acknowledgements: [
AboutWindowAcknowledgementSection(
name: 'Special Thanks to',
people: [
AboutWindowPerson(
name: 'My Cat',
),
],
),
],
details: AboutWindowDetails(
comments: """
Typeset is an app that doesn't exist and is used as an example content for this about window.""",
links: {
'Website': 'https://example.org',
'Documentation': 'https://example.org',
},
),
legalSections: [
AboutWindowLegalSection(
title: 'This Application',
copyright: '© 2022',
license: '''
This application comes with absolutely no warranty. See the GNU Lesser General Public License, version 2.1 or later for details''',
),
AboutWindowLegalSection(
title: 'Fonts',
copyright: '© 2022',
license: 'This application uses font data from somewhere.'),
],
),
);
},
),
);
}
}
24 changes: 12 additions & 12 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
bitsdojo_window_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -63,7 +63,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
charcode:
dependency: transitive
description:
Expand All @@ -77,7 +77,7 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: transitive
description:
Expand Down Expand Up @@ -105,7 +105,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -197,21 +197,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
package_info_plus:
dependency: transitive
description:
Expand Down Expand Up @@ -260,7 +260,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
path_drawing:
dependency: transitive
description:
Expand Down Expand Up @@ -321,7 +321,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand All @@ -342,21 +342,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
typed_data:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:libadwaita/libadwaita.dart';

class AboutWindowAcknowledgementSection {
AboutWindowAcknowledgementSection({required this.name, required this.people});

final String name;
final List<AboutWindowPerson> people;
}
6 changes: 6 additions & 0 deletions lib/src/models/about_window/about_window_details.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AboutWindowDetails {
AboutWindowDetails({this.comments, this.links});

final String? comments;
final Map<String, String>? links;
}
8 changes: 8 additions & 0 deletions lib/src/models/about_window/about_window_legal.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class AboutWindowLegalSection {
AboutWindowLegalSection(
{required this.title, required this.copyright, required this.license,});

final String title;
final String copyright;
final String license;
}
6 changes: 6 additions & 0 deletions lib/src/models/about_window/about_window_person.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AboutWindowPerson {
AboutWindowPerson({required this.name, this.url});

final String name;
final String? url;
}
5 changes: 5 additions & 0 deletions lib/src/models/models.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
export 'about_window/about_window_acknowledgement_section.dart';
export 'about_window/about_window_details.dart';
export 'about_window/about_window_legal.dart';
export 'about_window/about_window_person.dart';
export 'about_window/about_window_person.dart';
export 'view_switcher_data.dart';
export 'view_switcher_policy.dart';
Loading