julienandco / google_places_autocomplete_text_field

BSD 3-Clause "New" or "Revised" License
7 stars 25 forks source link

Adding hint does not work #4

Closed tieorange closed 9 months ago

tieorange commented 9 months ago

Code:

GooglePlacesAutoCompleteTextFormField(
            textEditingController: controller,
            googleAPIKey: AppConstants.googlePlacesApiKey,
            debounceTime: 550,
            decoration: const InputDecoration(
              enabledBorder: OutlineInputBorder(
                borderSide: BorderSide(color: Color(0xff0E9447), width: 2.0),
              ),
              focusedBorder: OutlineInputBorder(
                borderSide: BorderSide(color: Color(0xff0E9447), width: 2.0),
              ),
              hintText: 'AppStrings.email',
              labelText: 'AppStrings.email',
              alignLabelWithHint: true,
              hintStyle: TextStyle(color: Colors.red),
            ),
            maxLines: 1,
            overlayContainer: (child) => Material(
              elevation: 1,
              borderRadius: BorderRadius.circular(12),
              child: child,
            ),
            getPlaceDetailWithLatLng: (prediction) {
              log('placeDetails${prediction.toJson()}');
              // prediction.structuredFormatting.mainText
            },
            itmClick: (prediction) {
              final description = prediction.description ?? '';

              controller
                ..text = description
                ..selection = TextSelection.fromPosition(
                  TextPosition(offset: description.length),
                );
            },
          ),

Result:

image
julienandco commented 9 months ago

@tieorange Thank you for submitting this issue! I found the problem, it is due to a duplicate field that I will remove with the next version. For now, use inputDecoration instead of decoration.

julienandco commented 9 months ago

@tieorange The issue is fixed in the version 0.1.3