Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 573cabd

Browse files
committed
Monorepo implementation
1 parent 2e89efd commit 573cabd

File tree

23 files changed

+2963
-663
lines changed

23 files changed

+2963
-663
lines changed

.dart_tool/package_config.json

Lines changed: 868 additions & 0 deletions
Large diffs are not rendered by default.

.dart_tool/package_graph.json

Lines changed: 1384 additions & 0 deletions
Large diffs are not rendered by default.

.dart_tool/pub/workspace_ref.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"workspaceRoot": "..\\.."
3+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.vscode/
1+
.vscode/
2+
/pubspec.lock

builder/pubspec.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
name: oghref_builder
22
description: A Flutter widget for displaying rich information link with callback action provided.
3-
version: 4.1.3
3+
version: 5.0.0
44
repository: https://github.com/rk0cc/oghref/tree/main/builder
55
issue_tracker: https://github.com/rk0cc/oghref/issues
66
funding:
77
- https://github.com/sponsors/rk0cc
88
environment:
9-
sdk: '>=3.3.0 <4.0.0'
10-
flutter: '>=3.19.0'
9+
sdk: ^3.8.0
10+
flutter: '>=3.32.0'
11+
resolution: workspace
1112
dependencies:
1213
flutter:
1314
sdk: flutter
14-
url_launcher: ^6.2.3
15-
oghref_model: ^3.5.1
16-
meta: ^1.12.0
17-
url_launcher_platform_interface: ^2.3.1
18-
http: ^1.1.1
15+
url_launcher: ^6.3.2
16+
oghref_model: ^5.0.0
17+
meta: ^1.15.0
18+
url_launcher_platform_interface: ^2.3.2
19+
http: ^1.5.0
1920
dev_dependencies:
2021
flutter_test:
2122
sdk: flutter
22-
flutter_lints: ^4.0.0
23-
flutter:
23+
flutter_lints: ^5.0.0

media_control/lib/src/playback.dart

Lines changed: 76 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter/widgets.dart';
33
import 'package:media_kit/media_kit.dart';
44
import 'package:media_kit_video/media_kit_video.dart';
55
import 'package:http/http.dart' show Response, Client;
6+
import 'package:oghref_model/verifiers.dart';
67

78
import 'client.dart';
89
import 'testing_mode.dart' if (dart.library.io) 'testing_mode_io.dart';
@@ -27,11 +28,12 @@ final class MediaPlaybackPreference {
2728
final double videoScale;
2829

2930
/// Create preference
30-
const MediaPlaybackPreference(
31-
{this.muted = true,
32-
this.autoplay = true,
33-
this.videoSize = (width: null, height: null),
34-
this.videoScale = 1.0});
31+
const MediaPlaybackPreference({
32+
this.muted = true,
33+
this.autoplay = true,
34+
this.videoSize = (width: null, height: null),
35+
this.videoScale = 1.0,
36+
});
3537
}
3638

3739
/// A [Widget] for handle audio and video playback if offered.
@@ -60,15 +62,17 @@ final class MediaPlayback extends StatefulWidget {
6062
/// behavourial of [Dart's built in client](https://api.dart.dev/stable/dart-io/HttpClient-class.html).
6163
/// Therefore, [UnsupportedError] will be thrown if attempted to
6264
/// build it.
63-
MediaPlayback(Iterable<Uri> resources,
64-
{required this.onLoadFailed,
65-
this.onLoading,
66-
this.preference = const MediaPlaybackPreference(),
67-
super.key})
68-
: resources = List.unmodifiable(resources) {
65+
MediaPlayback(
66+
Iterable<Uri> resources, {
67+
required this.onLoadFailed,
68+
this.onLoading,
69+
this.preference = const MediaPlaybackPreference(),
70+
super.key,
71+
}) : resources = List.unmodifiable(resources) {
6972
if (isTesting) {
7073
throw UnsupportedError(
71-
"No real network interaction allowed during test, and it should never be built.");
74+
"No real network interaction allowed during test, and it should never be built.",
75+
);
7276
}
7377
}
7478

@@ -96,48 +100,45 @@ final class _MediaPlaybackState extends State<MediaPlayback> {
96100
Future<bool> _playableCond() async {
97101
final Client c = OgHrefMediaClient();
98102

99-
Stream<Response> resps =
100-
Stream.fromFutures(widget.resources.map((e) => c.head(e)));
101-
102-
return resps.every((r) {
103-
String? mime = r.headers["content-type"]?.split(';').first;
104-
105-
if (mime != null) {
106-
return RegExp(
107-
r"^(audio|video)\/((?:x-)?(?:[\w-]+\.)*[\w-]+(?:\+[\w-]+)?)$",
108-
dotAll: true,
109-
caseSensitive: false)
110-
.hasMatch(mime);
111-
}
112-
113-
return false;
114-
}).then((value) {
115-
c.close();
116-
return value;
117-
});
103+
Stream<Response> resps = Stream.fromFutures(
104+
widget.resources.map((e) => c.head(e)),
105+
);
106+
107+
return resps
108+
.every(
109+
(r) => switch (r.contentTypeCategory) {
110+
ContentTypeCategory.audio || ContentTypeCategory.video => true,
111+
_ => false,
112+
},
113+
)
114+
.then((value) {
115+
c.close();
116+
return value;
117+
});
118118
}
119119

120120
@override
121121
Widget build(BuildContext context) {
122122
return FutureBuilder<bool>(
123-
future: allPlayable,
124-
builder: (context, snapshot) {
125-
if (snapshot.hasError) {
126-
return widget.onLoadFailed(context);
127-
} else if (!snapshot.hasData ||
128-
snapshot.connectionState == ConnectionState.waiting) {
129-
return (widget.onLoading ?? (_) => const SizedBox())(context);
130-
}
131-
132-
return snapshot.data!
133-
? _MediaPlaybackRender()
134-
: widget.onLoadFailed(context);
135-
});
123+
future: allPlayable,
124+
builder: (context, snapshot) {
125+
if (snapshot.hasError) {
126+
return widget.onLoadFailed(context);
127+
} else if (!snapshot.hasData ||
128+
snapshot.connectionState == ConnectionState.waiting) {
129+
return (widget.onLoading ?? (_) => const SizedBox())(context);
130+
}
131+
132+
return snapshot.data!
133+
? _MediaPlaybackRender()
134+
: widget.onLoadFailed(context);
135+
},
136+
);
136137
}
137138
}
138139

139140
final class _MediaPlaybackRender extends StatefulWidget {
140-
// ignore: unused_element
141+
// ignore: unused_element_parameter
141142
_MediaPlaybackRender({super.key});
142143

143144
@override
@@ -154,29 +155,42 @@ final class _MediaPlaybackRenderState extends State<_MediaPlaybackRender> {
154155
void initState() {
155156
super.initState();
156157

157-
final MediaPlayback playbackWidget =
158-
context.findAncestorStateOfType<_MediaPlaybackState>()!.widget;
158+
final MediaPlayback playbackWidget = context
159+
.findAncestorStateOfType<_MediaPlaybackState>()!
160+
.widget;
159161

160162
final MediaPlaybackPreference preference = playbackWidget.preference;
161163

162164
player = Player(
163-
configuration: PlayerConfiguration(
164-
protocolWhitelist: _protocolWhitelist,
165-
muted: preference.muted,
166-
title: "OgHref media playback component"));
167-
168-
vidCtrl = VideoController(player,
169-
configuration: VideoControllerConfiguration(
170-
width: preference.videoSize.width,
171-
height: preference.videoSize.height,
172-
scale: preference.videoScale));
165+
configuration: PlayerConfiguration(
166+
protocolWhitelist: _protocolWhitelist,
167+
muted: preference.muted,
168+
title: "OgHref media playback component",
169+
),
170+
);
171+
172+
vidCtrl = VideoController(
173+
player,
174+
configuration: VideoControllerConfiguration(
175+
width: preference.videoSize.width,
176+
height: preference.videoSize.height,
177+
scale: preference.videoScale,
178+
),
179+
);
173180

174181
player.open(
175-
Playlist(playbackWidget.resources
176-
.map((e) => Media(e.toString(),
177-
httpHeaders: {"user-agent": requestUserAgent}))
178-
.toList()),
179-
play: preference.autoplay);
182+
Playlist(
183+
playbackWidget.resources
184+
.map(
185+
(e) => Media(
186+
e.toString(),
187+
httpHeaders: {"user-agent": requestUserAgent},
188+
),
189+
)
190+
.toList(),
191+
),
192+
play: preference.autoplay,
193+
);
180194
}
181195

182196
@override

media_control/pubspec.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
name: oghref_media_control
22
description: Additional package for providing mixin to build widget for playing multimedia resources
3-
version: 4.0.1
3+
version: 5.0.0
44
repository: https://github.com/rk0cc/oghref/tree/main/media_control
55
issue_tracker: https://github.com/rk0cc/oghref/issues
66
environment:
7-
sdk: '>=3.3.0 <4.0.0'
8-
flutter: '>=3.19.0'
7+
sdk: ^3.8.0
8+
flutter: '>=3.32.0'
9+
resolution: workspace
910
dependencies:
1011
flutter:
1112
sdk: flutter
12-
media_kit: ^1.1.10+1
13-
media_kit_video: ^1.2.4
14-
media_kit_libs_video: ^1.0.4
15-
meta: ^1.9.1
16-
http: ^1.1.0
17-
collection: ^1.18.0
18-
web: ^0.5.1
13+
media_kit: ^1.2.0
14+
media_kit_video: ^1.3.0
15+
media_kit_libs_video: ^1.0.6
16+
meta: ^1.15.0
17+
http: ^1.5.0
18+
collection: ^1.19.1
19+
web: ^1.1.1
20+
oghref_model: ^5.0.0
1921
dev_dependencies:
20-
flutter_lints: ">=3.0.1 <5.0.0"
21-
flutter:
22+
flutter_lints: ^5.0.0

model/lib/src/content_type_verifier.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ enum ContentTypeCategory {
2828
}
2929

3030
/// Perform verification from retriving `Content-Type` in [Response.headers].
31-
@internal
3231
extension ContentTypeVerifier on Response {
3332
/// Get the `Content-Type` value directly from [headers].
3433
String? get contentType => headers["content-type"];

model/lib/verifiers.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/// Additional libarary for verifying information given from OgHref.
22
library verifiers;
33

4-
export 'src/content_type_verifier.dart' hide ContentTypeVerifier;
4+
export 'src/content_type_verifier.dart';

model/pubspec.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: oghref_model
22
description: Object standarized definition with parser interface for constructing rich information of given URL among various metadata protocols.
3-
version: 3.6.0
3+
version: 5.0.0
44
repository: https://github.com/rk0cc/oghref/tree/main/model
55
issue_tracker: https://github.com/rk0cc/oghref/issues
66
funding:
@@ -10,16 +10,17 @@ topics:
1010
- http
1111
- metadata
1212
environment:
13-
sdk: '>=3.3.0 <4.0.0'
13+
sdk: ^3.8.0
14+
resolution: workspace
1415
dependencies:
15-
meta: ^1.12.0
16-
http: ^1.1.0
17-
html: '>=0.15.4 <1.0.0'
16+
meta: ^1.15.0
17+
http: ^1.5.0
18+
html: '>=0.15.6 <1.0.0'
19+
path: ^1.9.1
20+
web: ^1.1.1
21+
fetch_client: ^1.1.4
1822
mime_dart: ^3.0.0
19-
path: ^1.8.3
20-
web: ^0.5.1
21-
fetch_client: ^1.1.2
2223
dev_dependencies:
23-
lints: ^4.0.0
24-
test: ^1.24.8
24+
lints: ^5.0.0
25+
test: ^1.25.15
2526

0 commit comments

Comments
 (0)