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

Possible bug using Flutter Web 3.24.4 #336

Closed
vinicius-gregorio opened this issue Nov 9, 2024 · 3 comments
Closed

Possible bug using Flutter Web 3.24.4 #336

vinicius-gregorio opened this issue Nov 9, 2024 · 3 comments

Comments

@vinicius-gregorio
Copy link

Describe the bug
Everything is as in the README.MD and docs, but still not working a simple text.

To Reproduce

  1. Create a simple json structure
const json01 = {
  "type": "text",
  "args": {"data": "Hello, World!"}
};
  1. Create a simple page
import 'package:fl_server_driven/common/widgets/global_appbar/global_appbar.dart';
import 'package:fl_server_driven/common/widgets/global_drawer/global_drawer.dart';
import 'package:fl_server_driven/data/json/json01.dart';
import 'package:json_dynamic_widget/json_dynamic_widget.dart';

class RendererHomePage extends StatefulWidget {
  const RendererHomePage({super.key});

  @override
  State<RendererHomePage> createState() => _RendererHomePageState();
}

class _RendererHomePageState extends State<RendererHomePage> {
  late JsonWidgetData? _data;

  @override
  void initState() {
    super.initState();
    _data = JsonWidgetData.fromDynamic(json01,
        registry: JsonWidgetRegistry.instance);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey[200],
      appBar: GlobalAppbar(title: "Renderer"),
      drawer: GlobalDrawer(),
      body: Column(
        children: [
          if (_data != null)
            Container(
              decoration: BoxDecoration(
                  color: Colors.transparent,
                  border: Border.all(
                    color: Colors.black,
                    width: 1,
                  )),
              width: 500,
              height: 300,
              child: _data!.build(
                context: context,
                registry: JsonWidgetRegistry.instance,
              ),
            )
        ],
      ),
    );
  }
}
  1. This will create a Container with nothing inside:
    image

Note: No errors on console.

Expected behavior
A text with "Hello, World!" inside.
image

Enviroment

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.4, on Microsoft Windows [versao 10.0.22631.4317], locale pt-BR)        
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.1.4)
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Community Edition (version 2022.1)
[✓] VS Code, 64-bit edition (version 1.94.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Pubspec.yaml of my test project:

name: json_widget_test
description: "A new Flutter project."

version: 0.0.0+1
environment:
  sdk: ^3.5.4

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.8
  build_runner: ^2.4.13
  json_dynamic_widget_codegen: ^1.0.6
  json_dynamic_widget_plugin_components: ^1.0.1
  json_dynamic_widget_plugin_font_awesome: ^4.0.0+24
  json_dynamic_widget_plugin_ionicons: ^4.0.0+28
  json_dynamic_widget_plugin_js: ^2.0.2+20
  json_dynamic_widget_plugin_lottie: ^4.0.0+23
  json_dynamic_widget_plugin_material_icons: ^4.0.0+24
  json_dynamic_widget_plugin_markdown: ^5.0.0+16
  json_dynamic_widget_plugin_rive: ^4.0.0+15
  json_dynamic_widget_plugin_svg: ^4.0.0+25
  flutter_modular: ^6.3.4
  json_dynamic_widget: ^7.3.1+6

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^5.0.0
flutter:
  uses-material-design: true

OS:

Windows 11 / MacOS Sonoma 14.7

@vinicius-gregorio
Copy link
Author

vinicius-gregorio commented Nov 9, 2024

IF I'm being dumb, could you point where the problem relies?

@vinicius-gregorio vinicius-gregorio changed the title Possible bug using Flutter 3.24.4 Possible bug using Flutter Web 3.24.4 Nov 9, 2024
@vinicius-gregorio
Copy link
Author

vinicius-gregorio commented Nov 9, 2024

I was being dumb.
after debugging it for 4h I noticed.
The problem was inside the json structure.
Before:

const json01 = {
  "type": "text",
  "args": {"data": "Hello, World!"}
};

after:

const json01 = {
  "type": "text",
  "args": {"text": "Hello, World!"}
};

I think the problem relies where the EXPORTER is exporting the "Text" args as "data". And not as "text"

@jpeiffer
Copy link
Contributor

So wait,.is there an issue? If so, please reopen this. It seems like the problem may not be with the renderer but with the exporter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants