-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
Assertion failure after setting theme data in MaterialApp -implicit_animations.dart 'style !=null' #11513
Comments
The MaterialApp is using the TextTheme's @Hixie should the TextTheme constructor insist that all styles by non-null? You can construct a TextTheme based on an existing theme that overrides some of its styles: textTheme: new Typography(platform: defaultTargetPlatform).black.copyWith(
title: const TextStyle(inherit: true, fontWeight: FontWeight.bold, color: Colors.black, fontSize: 20.0),
), |
Yeah, the TextTheme constructor should probably require that all the data be filled in. We might need some constructors that make that easier. |
I'm facing the same issue. Here is the error logs: I/flutter (19312): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (19312): The following assertion was thrown building WidgetsApp-[GlobalObjectKey
I/flutter (19312): _MaterialAppState#839ea](dirty, state: _WidgetsAppState#dd50d):
I/flutter (19312): 'package:flutter/src/widgets/title.dart': Failed assertion: line 24 pos 15: 'color != null &&
I/flutter (19312): color.alpha == 0xFF': is not true.
I/flutter (19312): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (19312): more information in this error message to help you determine and fix the underlying cause.
I/flutter (19312): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (19312): https://github.com/flutter/flutter/issues/new
I/flutter (19312): When the exception was thrown, this was the stack:
I/flutter (19312): #2 new Title (package:flutter/src/widgets/title.dart)
I/flutter (19312): #3 _WidgetsAppState.build (package:flutter/src/widgets/app.dart:617:19)
I/flutter (19312): #4 StatefulElement.build (package:flutter/src/widgets/framework.dart:3730:27)
I/flutter (19312): #5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3642:15)
I/flutter (19312): #6 Element.rebuild (package:flutter/src/widgets/framework.dart:3495:5)
I/flutter (19312): #7 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3622:5)
I/flutter (19312): #8 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3769:11)
I/flutter (19312): #9 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3617:5)
I/flutter (19312): #10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2907:14)
I/flutter (19312): #11 Element.updateChild (package:flutter/src/widgets/framework.dart:2710:12)
I/flutter (19312): #12 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3653:16)
I/flutter (19312): #13 Element.rebuild (package:flutter/src/widgets/framework.dart:3495:5)
I/flutter (19312): #14 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3622:5)
I/flutter (19312): #15 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3617:5)
I/flutter (19312): #16 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2907:14)
I/flutter (19312): #17 Element.updateChild (package:flutter/src/widgets/framework.dart:2710:12)
I/flutter (19312): #18 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3653:16)
I/flutter (19312): #19 Element.rebuild (package:flutter/src/widgets/framework.dart:3495:5)
I/flutter (19312): #20 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3622:5)
I/flutter (19312): #21 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3617:5)
I/flutter (19312): #22 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2907:14)
I/flutter (19312): #23 Element.updateChild (package:flutter/src/widgets/framework.dart:2710:12)
I/flutter (19312): #24 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3653:16)
I/flutter (19312): #25 Element.rebuild (package:flutter/src/widgets/framework.dart:3495:5)
I/flutter (19312): #26 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3622:5)
I/flutter (19312): #27 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3617:5)
I/flutter (19312): #28 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2907:14)
I/flutter (19312): #29 Element.updateChild (package:flutter/src/widgets/framework.dart:2710:12)
I/flutter (19312): #30 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3653:16)
I/flutter (19312): #31 Element.rebuild (package:flutter/src/widgets/framework.dart:3495:5)
I/flutter (19312): #32 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3622:5)
I/flutter (19312): #33 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3769:11)
I/flutter (19312): #34 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3617:5)
I/flutter (19312): #35 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2907:14)
I/flutter (19312): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:2710:12)
I/flutter (19312): #37 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3653:16)
I/flutter (19312): #38 Element.rebuild (package:flutter/src/widgets/framework.dart:3495:5)
I/flutter (19312): #39 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3622:5)
I/flutter (19312): #40 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3617:5)
I/flutter (19312): #41 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2907:14)
I/flutter (19312): #42 Element.updateChild (package:flutter/src/widgets/framework.dart:2710:12)
I/flutter (19312): #43 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3653:16)
I/flutter (19312): #44 Element.rebuild (package:flutter/src/widgets/framework.dart:3495:5)
I/flutter (19312): #45 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3622:5)
I/flutter (19312): #46 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3769:11)
I/flutter (19312): #47 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3617:5)
I/flutter (19312): #48 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2907:14)
I/flutter (19312): #49 Element.updateChild (package:flutter/src/widgets/framework.dart:2710:12)
I/flutter (19312): #50 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:857:16)
I/flutter (19312): #51 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:828:5)
I/flutter (19312): #52 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:774:17)
I/flutter (19312): #53 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2222:19)
I/flutter (19312): #54 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:773:13)
I/flutter (19312): #55 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:662:7)
I/flutter (19312): #56 runApp (package:flutter/src/widgets/binding.dart:704:7)
I/flutter (19312): #57 main (file:///home/sand/AndroidStudioProjects/introduce_container/lib/main.dart:5:3)
I/flutter (19312): #58 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:279:19)
I/flutter (19312): #59 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
I/flutter (19312): (elided 2 frames from class _AssertionError) Code: import 'package:flutter/material.dart';
import './ui/home.dart';
void main() {
runApp(MaterialApp(
title: 'Theming Flutter',
home: Home(),
theme: ThemeData(
primaryColor: Colors.black54,
accentColor: Colors.teal.shade500,
brightness: Brightness.light,
textTheme: TextTheme(
title: TextStyle(color: Colors.black54, fontSize: 36.0),
body1: TextStyle(color: Colors.black54, fontSize: 18.0),
),
backgroundColor: Colors.white
),
));
}
Note that if I remove the theme prop, the error is no longer appear. |
Hello, the problem is you can't use colors with transparency in primary and accent colors. |
@diefferson There is no transparent color usage in this example. |
Hi @jamesgopinath |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
Sample code which produces this error.
Logs
Flutter Doctor
The text was updated successfully, but these errors were encountered: