Skip to content
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

Allow ui_state attribute to be used with arbitrary associated struct name #2393

Merged
merged 8 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ fn generate_dart_boilerplate() -> String {
r###"
import 'package:flutter/material.dart';

Future<void> runRustApp({
required Widget Function(RustState state) body,
required RustState Function() state,
Future<void> runRustApp<T>({
required Widget Function(T state) body,
required T Function() state,
}) async {
await RustLib.init();
runApp(_MyApp(body: body, state: state()));
runApp(_MyApp(body: (s) => body(s), state: state()));
}

// improve typing later
class _MyApp extends StatefulWidget {
final Widget Function(RustState state) body;
final RustState state;
final Widget Function(dynamic state) body;
final dynamic state;

const _MyApp({
required this.body,
Expand Down
12 changes: 6 additions & 6 deletions frb_example/rust_ui_counter/ui/lib/src/rust/frb_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -678,18 +678,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {

// Section: extra_from_parser

Future<void> runRustApp({
required Widget Function(RustState state) body,
required RustState Function() state,
Future<void> runRustApp<T>({
required Widget Function(T state) body,
required T Function() state,
}) async {
await RustLib.init();
runApp(_MyApp(body: body, state: state()));
runApp(_MyApp(body: (s) => body(s), state: state()));
}

// improve typing later
class _MyApp extends StatefulWidget {
final Widget Function(RustState state) body;
final RustState state;
final Widget Function(dynamic state) body;
final dynamic state;

const _MyApp({
required this.body,
Expand Down
12 changes: 6 additions & 6 deletions frb_example/rust_ui_todo_list/ui/lib/src/rust/frb_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -898,18 +898,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {

// Section: extra_from_parser

Future<void> runRustApp({
required Widget Function(RustState state) body,
required RustState Function() state,
Future<void> runRustApp<T>({
required Widget Function(T state) body,
required T Function() state,
}) async {
await RustLib.init();
runApp(_MyApp(body: body, state: state()));
runApp(_MyApp(body: (s) => body(s), state: state()));
}

// improve typing later
class _MyApp extends StatefulWidget {
final Widget Function(RustState state) body;
final RustState state;
final Widget Function(dynamic state) body;
final dynamic state;

const _MyApp({
required this.body,
Expand Down
Loading