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

Bug: QRImage disappears on eyeball customisation #179

Open
ShimronAlakkal opened this issue Jun 5, 2022 · 2 comments
Open

Bug: QRImage disappears on eyeball customisation #179

ShimronAlakkal opened this issue Jun 5, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ShimronAlakkal
Copy link

Describe the bug
When using the eyeStyleing, the existing qr image disappears.

Code

 Center(
              child: QrImage(
                  gapless: false,
                  semanticsLabel: 'Proud Zellow User',
                  data: baseUrl + FirebaseAuth.instance.currentUser!.uid,
                  dataModuleStyle: QrDataModuleStyle(
                    dataModuleShape: QrDataModuleShape.circle,
                    color: ColorPalette().secondaryTextColor,
                  ),
                  eyeStyle: QrEyeStyle(eyeShape: QrEyeShape.circle),
                  size: MediaQuery.of(context).size.height * 0.35),
            ),

Error on debug

The following _CastError was thrown during paint():
Null check operator used on a null value

The relevant error-causing widget was
QrImage

The following RenderObject was being processed when the exception was fired: RenderCustomPaint#c2ad7
RenderObject: RenderCustomPaint#c2ad7
    parentData: offset=Offset(10.0, 10.0) (can use size)
    constraints: BoxConstraints(w=238.1, h=238.1)
    size: Size(238.1, 238.1)
    painter: QrPainter#0a4bb()
@ShimronAlakkal ShimronAlakkal added the bug Something isn't working label Jun 5, 2022
@Edgar-P-yan
Copy link

Having the same issue while developing a macOS desktop app, i also successfully reproduced the same bug in a new empty project without any other dependencies. The issue only appears if i specify either eyeStyle or dataModuleStyle. Without those options the QR code shows correctly.
Reproducing code. The QR code in this case shows only the 3 corder big squares, the rest is just empty:

import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
            QrImageView(
              data: 'placeholder',
              version: QrVersions.auto,
              size: 300,
              gapless: true,
              dataModuleStyle: const QrDataModuleStyle(
                dataModuleShape: QrDataModuleShape.circle,
              ),
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
════════ Exception caught by rendering library ═════════════════════════════════
Null check operator used on a null value
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
Null check operator used on a null value
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
Null check operator used on a null value
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
The following _TypeError was thrown during paint():
Null check operator used on a null value

The relevant error-causing widget was:
    QrImageView QrImageView:file:///REDACTED/lib/screens/auth/auth_screen.dart:281:23

When the exception was thrown, this was the stack:
#0      QrPainter._drawFinderPatternItem (package:qr_flutter/src/qr_painter.dart:358:63)
#1      QrPainter.paint (package:qr_flutter/src/qr_painter.dart:207:5)
#2      RenderCustomPaint._paintWithPainter (package:flutter/src/rendering/custom_paint.dart:588:13)
#3      RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:630:7)
#4      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#5      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#6      RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:74:15)
#7      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#8      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#9      _RenderColoredBox.paint (package:flutter/src/widgets/basic.dart:7826:15)
#10     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#11     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#12     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:130:13)
#13     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#14     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#15     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:130:13)
#16     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#17     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#18     _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:356:15)
#19     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#20     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#21     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3158:15)
#22     RenderFlex.paint (package:flutter/src/rendering/flex.dart:1014:7)
#23     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#24     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#25     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:130:13)
#26     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#27     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#28     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:74:15)
#29     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#30     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#31     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3158:15)
#32     RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:409:5)
#33     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#34     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#35     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:130:13)
#36     _RenderInkFeatures.paint (package:flutter/src/material/material.dart:662:11)
#37     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#38     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#39     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:130:13)
#40     RenderPhysicalModel.paint.<anonymous closure> (package:flutter/src/rendering/proxy_box.dart:2033:15)
#41     PaintingContext.pushClipRRect (package:flutter/src/rendering/object.dart:575:14)
#42     RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:2020:21)
#43     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#44     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#45     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3158:15)
#46     RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:409:5)
#47     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#48     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#49     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:130:13)
#50     _RenderInkFeatures.paint (package:flutter/src/material/material.dart:662:11)
#51     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#52     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#53     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:130:13)
#54     RenderPhysicalModel.paint.<anonymous closure> (package:flutter/src/rendering/proxy_box.dart:2033:15)
#55     PaintingContext.pushClipRRect (package:flutter/src/rendering/object.dart:575:14)
#56     RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:2020:21)
#57     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#58     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#59     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:130:13)
#60     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#61     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:250:13)
#62     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:130:13)
#63     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#64     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:166:11)
#65     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:109:5)
#66     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1182:31)
#67     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1192:15)
#68     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:579:23)
#69     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1138:13)
#70     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:443:5)
#71     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1392:15)
#72     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1313:9)
#73     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:1035:9)
#74     PlatformDispatcher.scheduleWarmUpFrame.<anonymous closure> (dart:ui/platform_dispatcher.dart:837:16)
#78     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
(elided 3 frames from class _Timer and dart:async-patch)

The following RenderObject was being processed when the exception was fired: RenderCustomPaint#ca91d
    parentData: offset=Offset(10.0, 10.0) (can use size)
    constraints: BoxConstraints(w=280.0, h=280.0)
    size: Size(280.0, 280.0)
    painter: QrPainter#5c6c2()
RenderObject: RenderCustomPaint#ca91d
    parentData: offset=Offset(10.0, 10.0) (can use size)
    constraints: BoxConstraints(w=280.0, h=280.0)
    size: Size(280.0, 280.0)
    painter: QrPainter#5c6c2()
════════════════════════════════════════════════════════════════════════════════
Reloaded 1 of 3657 libraries in 477ms (compile: 34 ms, reload: 274 ms, reassemble: 161 ms).

════════ Exception caught by rendering library ═════════════════════════════════
Null check operator used on a null value
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
Null check operator used on a null value
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants