locationpicker icon indicating copy to clipboard operation
locationpicker copied to clipboard

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

Open DavidSamir opened this issue 4 years ago • 6 comments

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`

DavidSamir avatar Aug 28 '21 22:08 DavidSamir

you can use this for ow

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

mu-dawood avatar Sep 10 '21 04:09 mu-dawood

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

auric-co avatar Oct 16 '21 13:10 auric-co

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

Same error any solution ?

Sreejith93 avatar Oct 17 '21 09:10 Sreejith93

/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.

xbtasvs avatar Oct 22 '21 13:10 xbtasvs

@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,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^

lucasjinreal avatar Oct 24 '21 07:10 lucasjinreal

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

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

mu-dawood avatar Oct 24 '21 15:10 mu-dawood