Skip to content

Commit

Permalink
Update deep link validation tool UI (#6704)
Browse files Browse the repository at this point in the history
* 1

* lint

* resolve comments

* Update deep_links_controller.dart
  • Loading branch information
hannah-hyj authored Nov 10, 2023
1 parent fec80c6 commit 17de972
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class _DeepLinkListViewMainPanel extends StatelessWidget {
Expanded(
child: _AllDeepLinkDataTable(controller: controller),
),
VerticalDivider(
width: 1.0,
color: Theme.of(context).focusColor,
),
Expanded(
child: ValueListenableBuilder<LinkData?>(
valueListenable: controller.selectedLink,
Expand Down Expand Up @@ -277,6 +281,7 @@ class _AllDeepLinkDataTable extends StatelessWidget {
return Column(
children: <Widget>[
OutlineDecoration(
showRight: false,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand All @@ -300,6 +305,7 @@ class _AllDeepLinkDataTable extends StatelessWidget {
onChanged: (value) {
controller.searchContent = value;
},
controller: controller.textEditingController,
),
),
),
Expand Down Expand Up @@ -390,7 +396,11 @@ class _NotificationCardSection extends StatelessWidget {
);
controller.updateDisplayOptions(showSplitScreen: true);
},
child: const Text('Fix domain'),
child: const Padding(
padding:
EdgeInsets.symmetric(horizontal: intermediateSpacing),
child: Text('Fix domain'),
),
),
),
if (domainErrorCount > 0 && pathErrorCount > 0)
Expand All @@ -411,7 +421,11 @@ class _NotificationCardSection extends StatelessWidget {
);
controller.updateDisplayOptions(showSplitScreen: true);
},
child: const Text('Fix path'),
child: const Padding(
padding:
EdgeInsets.symmetric(horizontal: intermediateSpacing),
child: Text('Fix path'),
),
),
),
],
Expand Down Expand Up @@ -444,8 +458,8 @@ class _NotificationCard extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(
defaultSpacing,
defaultSpacing,
defaultSpacing,
0,
densePadding,
denseSpacing,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'dart:convert';

import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_shared/devtools_deeplink.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:http/http.dart' as http;

import '../../shared/analytics/analytics.dart' as ga;
Expand Down Expand Up @@ -242,6 +242,9 @@ class DeepLinksController extends DisposableController {
final displayOptionsNotifier =
ValueNotifier<DisplayOptions>(DisplayOptions());

/// The [TextEditingController] for the search text field.
final textEditingController = TextEditingController();

Future<void> _generateAssetLinks() async {
final applicationId =
_androidAppLinks[selectedVariantIndex.value]?.applicationId ?? '';
Expand All @@ -265,9 +268,8 @@ class DeepLinksController extends DisposableController {
final Map<String, dynamic> result =
json.decode(response.body) as Map<String, dynamic>;
if (result[_domainsKey] != null) {
final String generatedContent =
(result[_domainsKey] as List<Map<String, dynamic>>)
.first[_generatedContentKey];
final String generatedContent = ((result[_domainsKey] as List).first
as Map<String, dynamic>)[_generatedContentKey];

generatedAssetLinksForSelectedLink.value = generatedContent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,7 @@ class _ErrorAwareText extends StatelessWidget {

class DomainColumn extends ColumnData<LinkData>
implements ColumnRenderer<LinkData>, ColumnHeaderRenderer<LinkData> {
DomainColumn(this.controller)
: super(
'Domain',
fixedWidthPx: scaleByFontFactor(kDeeplinkTableCellDefaultWidth),
);
DomainColumn(this.controller) : super.wide('Domain');

DeepLinksController controller;

Expand Down Expand Up @@ -202,11 +198,7 @@ class DomainColumn extends ColumnData<LinkData>

class PathColumn extends ColumnData<LinkData>
implements ColumnRenderer<LinkData>, ColumnHeaderRenderer<LinkData> {
PathColumn(this.controller)
: super(
'Path',
fixedWidthPx: scaleByFontFactor(kDeeplinkTableCellDefaultWidth),
);
PathColumn(this.controller) : super.wide('Path');

DeepLinksController controller;

Expand Down Expand Up @@ -259,23 +251,15 @@ class PathColumn extends ColumnData<LinkData>
}

class NumberOfAssociatedPathColumn extends ColumnData<LinkData> {
NumberOfAssociatedPathColumn()
: super(
'Number of associated path',
fixedWidthPx: scaleByFontFactor(kDeeplinkTableCellDefaultWidth),
);
NumberOfAssociatedPathColumn() : super.wide('Number of associated path');

@override
String getValue(LinkData dataObject) =>
dataObject.associatedPath.length.toString();
}

class NumberOfAssociatedDomainColumn extends ColumnData<LinkData> {
NumberOfAssociatedDomainColumn()
: super(
'Number of associated domain',
fixedWidthPx: scaleByFontFactor(kDeeplinkTableCellDefaultWidth),
);
NumberOfAssociatedDomainColumn() : super.wide('Number of associated domain');

@override
String getValue(LinkData dataObject) =>
Expand All @@ -284,11 +268,7 @@ class NumberOfAssociatedDomainColumn extends ColumnData<LinkData> {

class SchemeColumn extends ColumnData<LinkData>
implements ColumnRenderer<LinkData>, ColumnHeaderRenderer<LinkData> {
SchemeColumn(this.controller)
: super(
'Scheme',
fixedWidthPx: scaleByFontFactor(kDeeplinkTableCellDefaultWidth),
);
SchemeColumn(this.controller) : super.wide('Scheme');

DeepLinksController controller;

Expand Down Expand Up @@ -333,11 +313,7 @@ class SchemeColumn extends ColumnData<LinkData>

class OSColumn extends ColumnData<LinkData>
implements ColumnRenderer<LinkData>, ColumnHeaderRenderer<LinkData> {
OSColumn(this.controller)
: super(
'OS',
fixedWidthPx: scaleByFontFactor(kDeeplinkTableCellDefaultWidth),
);
OSColumn(this.controller) : super.wide('OS');

DeepLinksController controller;

Expand Down Expand Up @@ -383,11 +359,7 @@ class OSColumn extends ColumnData<LinkData>

class StatusColumn extends ColumnData<LinkData>
implements ColumnRenderer<LinkData>, ColumnHeaderRenderer<LinkData> {
StatusColumn(this.controller, this.viewType)
: super(
'Status',
fixedWidthPx: scaleByFontFactor(kDeeplinkTableCellDefaultWidth),
);
StatusColumn(this.controller, this.viewType) : super.wide('Status');

DeepLinksController controller;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'package:devtools_app_shared/ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import '../../shared/common_widgets.dart';
import '../../shared/table/table.dart';
Expand Down Expand Up @@ -83,7 +84,9 @@ class ValidationDetailHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
return OutlineDecoration(
child: Padding(
showLeft: false,
child: Container(
height: actionWidgetSize,
padding: const EdgeInsets.symmetric(horizontal: defaultSpacing),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expand Down Expand Up @@ -134,6 +137,7 @@ class _DomainCheckTable extends StatelessWidget {
DataColumn(label: Text('Issue type')),
DataColumn(label: Text('Status')),
],
headingRowHeight: areaPaneHeaderHeight,
dataRowMinHeight: defaultRowHeight,
dataRowMaxHeight: defaultRowHeight,
rows: [
Expand Down Expand Up @@ -192,54 +196,77 @@ class _DomainFixPanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
final linkData = controller.selectedLink.value!;
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Text('How to fix'),
Text(
'Add the new recommended Digital Asset Links JSON file to the failed website domain at the correct location.',
style: Theme.of(context).subtleTextStyle,
),
Text(
'Update and publish recommend Digital Asset Links JSON file below to this location: ',
style: Theme.of(context).subtleTextStyle,
),
Align(
alignment: Alignment.centerLeft,
child: Card(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
return ColoredBox(
color: Theme.of(context)
.colorScheme
.alternatingBackgroundColor2
.withOpacity(0.5),
child: Padding(
padding: const EdgeInsets.all(intermediateSpacing),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Text('How to fix:'),
Text(
'Add the new recommended Digital Asset Links JSON file to the failed website domain at the correct location.\n'
'Update and publish recommend Digital Asset Links JSON file below to this location: ',
style: Theme.of(context).subtleTextStyle,
),
color: Theme.of(context).colorScheme.outline,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: denseSpacing),
child: SelectionArea(
child: Text(
'https://${linkData.domain}/.well-known/assetlinks.json',
style: Theme.of(context).regularTextStyle.copyWith(
color: Colors.black,
fontWeight: FontWeight.w500,
),
Align(
alignment: Alignment.centerLeft,
child: Card(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
),
color: Theme.of(context).colorScheme.outline,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: denseSpacing),
child: SelectionArea(
child: Text(
'https://${linkData.domain}/.well-known/assetlinks.json',
style: Theme.of(context).regularTextStyle.copyWith(
color: Colors.black,
fontWeight: FontWeight.w500,
),
),
),
),
),
),
),
),
Card(
child: ValueListenableBuilder(
valueListenable: controller.generatedAssetLinksForSelectedLink,
builder: (_, String? generatedAssetLinks, __) =>
generatedAssetLinks != null
? Align(
alignment: Alignment.centerLeft,
child: SelectionArea(
child: Text(generatedAssetLinks),
),
)
: const CenteredCircularProgressIndicator(),
),
Card(
color: Theme.of(context).colorScheme.surface,
child: Padding(
padding: const EdgeInsets.all(denseSpacing),
child: ValueListenableBuilder(
valueListenable:
controller.generatedAssetLinksForSelectedLink,
builder: (_, String? generatedAssetLinks, __) =>
generatedAssetLinks != null
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: SelectionArea(
child: Text(generatedAssetLinks),
),
),
IconButton(
onPressed: () async =>
await Clipboard.setData(
ClipboardData(text: generatedAssetLinks),
),
icon: const Icon(Icons.copy),
),
],
)
: const CenteredCircularProgressIndicator(),
),
),
),
],
),
],
),
);
}
}
Expand Down Expand Up @@ -319,6 +346,9 @@ class _PathCheckTable extends StatelessWidget {
Opacity(
opacity: 0.5,
child: DataTable(
headingRowHeight: areaPaneHeaderHeight,
dataRowMinHeight: defaultRowHeight,
dataRowMaxHeight: defaultRowHeight,
headingRowColor: MaterialStateProperty.all(
Theme.of(context).colorScheme.deeplinkTableHeaderColor,
),
Expand Down

0 comments on commit 17de972

Please sign in to comment.