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

The getter 'body1' isn't defined for the class 'TextTheme'. #57

Open
DavidSamir opened this issue Aug 28, 2021 · 6 comments
Open

The getter 'body1' isn't defined for the class 'TextTheme'. #57

DavidSamir opened this issue Aug 28, 2021 · 6 comments

Comments

@DavidSamir
Copy link

I've just installed the package in my project and now every time I try to run the project crashes

I get this error message in the terminal

`λ flutter run
Using hardware rendering with device sdk gphone x86 arm. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/rich_suggestion.dart:35:89: Error: The getter 'body1' isn't defined for the class 'TextTheme'.

  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/text_theme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'body1'.
    TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1!.color)),
    ^^^^^
    ../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/search_input.dart:60:65: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/text_theme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'body1'.
    Icon(Icons.search, color: Theme.of(context).textTheme.body1!.color),
    ^^^^^

FAILURE: Build failed with an exception.

  • Where:
    Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1m 1s
Running Gradle task 'assembleDebug'... 64.4s
Exception: Gradle task assembleDebug failed with exit code 1`

@mu-dawood
Copy link

you can use this for ow

  place_picker:
    git: 
      url: https://github.com/mo-ah-dawood/locationpicker.git
      ref: nullsafety

@auric-co
Copy link

Getting the same error. When is the update coming to fix this

@Sreejith93
Copy link

Getting the same error. When is the update coming to fix this

Same error any solution ?

@xbtasvs
Copy link

xbtasvs commented Oct 22, 2021

/C:/Users/kuk/Documents/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/search_input.dart:60:65: Error: The getter 'body1' isn't defined for the class 'TextTheme'.

  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/Users/kuk/Documents/sdk/flutter/packages/flutter/lib/src/material/text_theme.dart').
    package:flutter/…/material/text_theme.dart:1
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'body1'.
    Icon(Icons.search, color: Theme.of(context).textTheme.body1!.color),
    ^^^^^

I am getting this error. Please let me know the solution.

@lucasjinreal
Copy link

@mo-ah-dawood Your solution build error:

Error: Couldn't resolve the package 'flutter_localizations' in 'package:flutter_localizations/flutter_localizations.dart'.
../../../../development/flutter/.pub-cache/git/locationpicker-29613afd29d6b854451e7feba81e4d6dcc98762b/lib/l10n/gen_l10n/place_picker_localizations.dart:6:8: Error: Not found: 'package:flutter_localizations/flutter_localizations.dart'
import 'package:flutter_localizations/flutter_localizations.dart';
       ^
../../../../development/flutter/.pub-cache/git/locationpicker-29613afd29d6b854451e7feba81e4d6dcc98762b/lib/l10n/gen_l10n/place_picker_localizations.dart:86:5: Error: Undefined name 'GlobalMaterialLocalizations'.
    GlobalMaterialLocalizations.delegate,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../development/flutter/.pub-cache/git/locationpicker-29613afd29d6b854451e7feba81e4d6dcc98762b/lib/l10n/gen_l10n/place_picker_localizations.dart:87:5: Error: Undefined name 'GlobalCupertinoLocalizations'.
    GlobalCupertinoLocalizations.delegate,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../development/flutter/.pub-cache/git/locationpicker-29613afd29d6b854451e7feba81e4d6dcc98762b/lib/l10n/gen_l10n/place_picker_localizations.dart:88:5: Error: Undefined name 'GlobalWidgetsLocalizations'.
    GlobalWidgetsLocalizations.delegate,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^

@mu-dawood
Copy link

@jinfagang try again after upgrading packages
you can also use PlacePickerLocalization.delegate

 return MaterialApp(
   localizationsDelegates: [
     /// ...other delegates,
     PlacePickerLocalization.delegate
   ],
   home: MyApplicationHome(),
 );
 

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

6 participants