Skip to content

Commit

Permalink
Merge branch 'main' into import-path-parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmorgan authored Oct 24, 2024
2 parents f4e409a + a556f0f commit 3727fa0
Show file tree
Hide file tree
Showing 32 changed files with 391 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .ci/flutter_master.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6790525ce673734ef3a913e301a7001e2f500703
4faa4a415ec9e96f933393e7b829a1c9768e1a66
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import 'package:integration_test/integration_test.dart';
import 'package:path_provider/path_provider.dart';
import 'package:video_player/video_player.dart';

// Skip due to video_player error.
// See https://github.com/flutter/flutter/issues/157181
bool skipFor157181 = Platform.isAndroid;

void main() {
late Directory testDir;

Expand Down Expand Up @@ -177,7 +181,7 @@ void main() {
await videoController.dispose();

expect(duration, lessThan(recordingTime));
});
}, skip: skipFor157181);

testWidgets('Pause and resume video recording', (WidgetTester tester) async {
final List<CameraDescription> cameras = await availableCameras();
Expand Down Expand Up @@ -225,7 +229,7 @@ void main() {
await videoController.dispose();

expect(duration, lessThan(recordingTime - timePaused));
}, skip: !Platform.isAndroid);
}, skip: !Platform.isAndroid || skipFor157181);

testWidgets(
'Android image streaming',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:video_player/video_player.dart';

// Skip due to video_player error.
// See https://github.com/flutter/flutter/issues/157181
const bool skipFor157181 = true;

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

Expand Down Expand Up @@ -210,7 +214,7 @@ void main() {
await videoController.dispose();

expect(duration, lessThan(postStopTime));
});
}, skip: skipFor157181);

testWidgets('Pause and resume video recording', (WidgetTester tester) async {
final List<CameraDescription> cameras = await availableCameras();
Expand Down Expand Up @@ -255,5 +259,5 @@ void main() {
await videoController.dispose();

expect(duration, lessThan(recordingTime - timePaused));
});
}, skip: skipFor157181);
}
4 changes: 4 additions & 0 deletions packages/file_selector/file_selector_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.1+10

* Bumps androidx.annotation:annotation from 1.8.2 to 1.9.0.

## 0.5.1+9

* Updates Java compatibility version to 11.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {
}

dependencies {
implementation 'androidx.annotation:annotation:1.8.2'
implementation 'androidx.annotation:annotation:1.9.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-inline:5.1.0'
testImplementation 'androidx.test:core:1.3.0'
Expand Down
2 changes: 1 addition & 1 deletion packages/file_selector/file_selector_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: file_selector_android
description: Android implementation of the file_selector package.
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
version: 0.5.1+9
version: 0.5.1+10

environment:
sdk: ^3.5.0
Expand Down
5 changes: 5 additions & 0 deletions packages/flutter_markdown/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.7.4+1

* Makes it so that custom blocks are not limited to being a Column or
SizedBox.

## 0.7.4

* Makes paragraphs in blockquotes soft-wrap like a normal `<blockquote>` instead of hard-wrapping like a `<pre>` block.
Expand Down
31 changes: 20 additions & 11 deletions packages/flutter_markdown/lib/src/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -383,20 +383,29 @@ class MarkdownBuilder implements md.NodeVisitor {
_addAnonymousBlockIfNeeded();

final _BlockElement current = _blocks.removeLast();
Widget child;

if (current.children.isNotEmpty) {
child = Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: fitContent
? CrossAxisAlignment.start
: CrossAxisAlignment.stretch,
children: current.children,
);
} else {
child = const SizedBox();
Widget defaultChild() {
if (current.children.isNotEmpty) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: fitContent
? CrossAxisAlignment.start
: CrossAxisAlignment.stretch,
children: current.children,
);
} else {
return const SizedBox();
}
}

Widget child = builders[tag]?.visitElementAfterWithContext(
delegate.context,
element,
styleSheet.styles[tag],
_inlines.isNotEmpty ? _inlines.last.style : null,
) ??
defaultChild();

if (_isListTag(tag)) {
assert(_listIndents.isNotEmpty);
_listIndents.removeLast();
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_markdown/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Markdown renderer for Flutter. Create rich text output,
formatted with simple Markdown tags.
repository: https://github.com/flutter/packages/tree/main/packages/flutter_markdown
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_markdown%22
version: 0.7.4
version: 0.7.4+1

environment:
sdk: ^3.3.0
Expand Down
80 changes: 80 additions & 0 deletions packages/flutter_markdown/test/custom_syntax_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,35 @@ void defineTests() {
},
);

testWidgets(
'Block with custom tag',
(WidgetTester tester) async {
const String textBefore = 'Before ';
const String textAfter = ' After';
const String blockContent = 'Custom content rendered in a ColoredBox';

await tester.pumpWidget(
boilerplate(
Markdown(
data:
'$textBefore\n{{custom}}\n$blockContent\n{{/custom}}\n$textAfter',
extensionSet: md.ExtensionSet.none,
blockSyntaxes: <md.BlockSyntax>[CustomTagBlockSyntax()],
builders: <String, MarkdownElementBuilder>{
'custom': CustomTagBlockBuilder(),
},
),
),
);

final ColoredBox container =
tester.widgetList(find.byType(ColoredBox)).first as ColoredBox;
expect(container.color, Colors.red);
expect(container.child, isInstanceOf<Text>());
expect((container.child! as Text).data, blockContent);
},
);

testWidgets(
'link for wikistyle',
(WidgetTester tester) async {
Expand Down Expand Up @@ -380,3 +409,54 @@ class NoteSyntax extends md.BlockSyntax {
@override
RegExp get pattern => RegExp(r'^\[!NOTE] ');
}

class CustomTagBlockBuilder extends MarkdownElementBuilder {
@override
bool isBlockElement() => true;

@override
Widget visitElementAfterWithContext(
BuildContext context,
md.Element element,
TextStyle? preferredStyle,
TextStyle? parentStyle,
) {
if (element.tag == 'custom') {
final String content = element.attributes['content']!;
return ColoredBox(
color: Colors.red, child: Text(content, style: preferredStyle));
}
return const SizedBox.shrink();
}
}

class CustomTagBlockSyntax extends md.BlockSyntax {
@override
bool canParse(md.BlockParser parser) {
return parser.current.content.startsWith('{{custom}}');
}

@override
RegExp get pattern => RegExp(r'\{\{custom\}\}([\s\S]*?)\{\{/custom\}\}');

@override
md.Node parse(md.BlockParser parser) {
parser.advance();

final StringBuffer buffer = StringBuffer();
while (
!parser.current.content.startsWith('{{/custom}}') && !parser.isDone) {
buffer.writeln(parser.current.content);
parser.advance();
}

if (!parser.isDone) {
parser.advance();
}

final String content = buffer.toString().trim();
final md.Element element = md.Element.empty('custom');
element.attributes['content'] = content;
return element;
}
}
4 changes: 4 additions & 0 deletions packages/image_picker/image_picker_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.12+17

* Bumps androidx.annotation:annotation from 1.8.2 to 1.9.0.

## 0.8.12+16

* Updates Pigeon for non-nullable collection type support.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ android {
}
dependencies {
implementation 'androidx.core:core:1.13.1'
implementation 'androidx.annotation:annotation:1.8.2'
implementation 'androidx.annotation:annotation:1.9.0'
implementation 'androidx.exifinterface:exifinterface:1.3.7'
implementation 'androidx.activity:activity:1.9.2'

Expand Down
2 changes: 1 addition & 1 deletion packages/image_picker/image_picker_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: image_picker_android
description: Android implementation of the image_picker plugin.
repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
version: 0.8.12+16
version: 0.8.12+17

environment:
sdk: ^3.5.0
Expand Down
4 changes: 4 additions & 0 deletions packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.6+11

* Bumps androidx.annotation:annotation from 1.8.2 to 1.9.0.

## 0.3.6+10

* Updates Pigeon for non-nullable collection type support.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ android {
}

dependencies {
implementation 'androidx.annotation:annotation:1.8.2'
implementation 'androidx.annotation:annotation:1.9.0'
implementation 'com.android.billingclient:billing:6.2.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.json:json:20240303'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: in_app_purchase_android
description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs.
repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
version: 0.3.6+10
version: 0.3.6+11

environment:
sdk: ^3.5.0
Expand Down
4 changes: 4 additions & 0 deletions packages/pigeon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 22.6.0

* [swift] Adds `includeErrorClass` to `SwiftOptions`.

## 22.5.0

* [swift] Adds implementation for `@ProxyApi`.
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/generator_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'ast.dart';
/// The current version of pigeon.
///
/// This must match the version in pubspec.yaml.
const String pigeonVersion = '22.5.0';
const String pigeonVersion = '22.6.0';

/// Read all the content from [stdin] to a String.
String readStdin() {
Expand Down
1 change: 1 addition & 0 deletions packages/pigeon/lib/pigeon_lib.dart
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ class SwiftGeneratorAdapter implements GeneratorAdapter {
path.posix.join(options.basePath ?? '', options.copyrightHeader))
: null,
errorClassName: swiftOptions.errorClassName,
includeErrorClass: swiftOptions.includeErrorClass,
));
const SwiftGenerator generator = SwiftGenerator();
generator.generate(
Expand Down
13 changes: 12 additions & 1 deletion packages/pigeon/lib/swift_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class SwiftOptions {
this.copyrightHeader,
this.fileSpecificClassNameComponent,
this.errorClassName,
this.includeErrorClass = true,
});

/// A copyright header that will get prepended to generated code.
Expand All @@ -39,6 +40,12 @@ class SwiftOptions {
/// The name of the error class used for passing custom error parameters.
final String? errorClassName;

/// Whether to include the error class in generation.
///
/// This should only ever be set to false if you have another generated
/// Swift file in the same directory.
final bool includeErrorClass;

/// Creates a [SwiftOptions] from a Map representation where:
/// `x = SwiftOptions.fromList(x.toMap())`.
static SwiftOptions fromList(Map<String, Object> map) {
Expand All @@ -47,6 +54,7 @@ class SwiftOptions {
fileSpecificClassNameComponent:
map['fileSpecificClassNameComponent'] as String?,
errorClassName: map['errorClassName'] as String?,
includeErrorClass: map['includeErrorClass'] as bool? ?? true,
);
}

Expand All @@ -58,6 +66,7 @@ class SwiftOptions {
if (fileSpecificClassNameComponent != null)
'fileSpecificClassNameComponent': fileSpecificClassNameComponent!,
if (errorClassName != null) 'errorClassName': errorClassName!,
'includeErrorClass': includeErrorClass,
};
return result;
}
Expand Down Expand Up @@ -1303,7 +1312,9 @@ private func nilOrValue<T>(_ value: Any?) -> T? {
.any((Api api) => api.methods.isNotEmpty);
final bool hasProxyApi = root.apis.any((Api api) => api is AstProxyApi);

_writePigeonError(generatorOptions, indent);
if (generatorOptions.includeErrorClass) {
_writePigeonError(generatorOptions, indent);
}

if (hasHostApi || hasProxyApi) {
_writeWrapResult(indent);
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pigeon
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
version: 22.5.0 # This must match the version in lib/generator_tools.dart
version: 22.6.0 # This must match the version in lib/generator_tools.dart

environment:
sdk: ^3.3.0
Expand Down
Loading

0 comments on commit 3727fa0

Please sign in to comment.