go-flutter icon indicating copy to clipboard operation
go-flutter copied to clipboard

Garbled text when external texture is used

Open urjitbhatia opened this issue 4 years ago • 1 comments

Hover doctor

 hover doctor
hover: Hover version v0.42.0 running on darwin
hover: Sharing flutter version
Flutter 1.18.0-11.1.pre • channel beta • [email protected]:flutter/flutter.git
Framework • revision 2738a1148b (3 weeks ago) • 2020-05-13 15:24:36 -0700
Engine • revision ef9215ceb2
Tools • Dart 2.9.0 (build 2.9.0-8.2.beta)
hover: Flutter engine commit: https://github.com/flutter/engine/commit/ef9215ceb2884ddf520d321bcd822d1461330876
hover: Finding out the C compiler version
Apple clang version 11.0.3 (clang-1103.0.32.59)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
hover: Sharing the content of go.mod
module github.com/go-flutter-desktop/examples/plugin_tutorial/desktop

go 1.12

require (
	github.com/go-flutter-desktop/go-flutter v0.41.0
	github.com/go-flutter-desktop/plugins/go-texture-example/example_gif v0.0.0-00010101000000-000000000000
	github.com/go-flutter-desktop/plugins/go-texture-example/example_image v0.0.1
	github.com/pkg/errors v0.9.1
)

replace github.com/go-flutter-desktop/plugins/go-texture-example/example_image => ../go-texture-example/image

replace github.com/go-flutter-desktop/plugins/go-texture-example/example_gif => ../go-texture-example/gif

// replace github.com/go-flutter-desktop/go-flutter => /home/drakirus/lab/go/src/github.com/go-flutter-desktop/go-flutter
hover: file hover.yaml not found: open go/hover.yaml: no such file or directory
hover: Sharing the content of go/cmd
go/cmd/main.go	go/cmd/options.go

Error

Using hover run to run my application. The text is garbled (looks like a corrupted texture). If I remove the texture, everything works fine. Gif Texture example is picked from examples. Screen Shot 2020-06-03 at 9 02 22 PM

I have a minimal repro in the example code:

import 'package:flutter/foundation.dart'
    show debugDefaultTargetPlatformOverride;
import 'package:flutter/material.dart';

void main() {
  debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
  runApp(MyApp());
}

class MyApp extends StatelessWidget {

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'go-flutter Texture API',
      theme: ThemeData(
        // If the host is missing some fonts, it can cause the
        // text to not be rendered or worse the app might crash.
        fontFamily: 'Roboto',
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('Texture Examples'),
        ),
        body: Center(
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: <Widget>[
              Expanded(
                  flex: 2,
                  child: Container(
                      decoration: BoxDecoration(
                          border: Border(right: BorderSide(width: 4))),
                      child: Text(
                        "Hello world",
                        style: TextStyle(fontSize: 50),
                      ))),
              Expanded(
                  flex: 2,
                  child: Container(
                      decoration: BoxDecoration(
                          border: Border(right: BorderSide(width: 4))),
                      child: Text(
                        "Hello world",
                        style: TextStyle(fontSize: 50),
                      ))),
              Expanded(
                flex: 8,
                child: Column(
                  children: <Widget>[
                    ConstrainedBox(
                      constraints: BoxConstraints.tight(Size(640, 480)),
                      // hard-coded to 2
                      // (Not the best practice, let go-flutter generate this ID
                      // and send it back to the dart code using platform
                      // messages)
                      child: Texture(textureId: 2),
                    ),
                    Text(
                      'Right Column: ',
                      style: TextStyle(fontSize: 40.0),
                      maxLines: 2,
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

urjitbhatia avatar Jun 04 '20 04:06 urjitbhatia

I'd love to know if this issue is also reproducible on AOT: https://github.com/go-flutter-desktop/hover/pull/147

This issue might come from the non-main-call to https://github.com/go-flutter-desktop/go-flutter/blob/master/texture.go#L26

But could also be a flutter/engine issue.

pchampio avatar Jun 04 '20 08:06 pchampio