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

polyline with gradient #452

Merged
merged 4 commits into from
Jan 7, 2020
Merged

Conversation

SebWojd
Copy link
Contributor

@SebWojd SebWojd commented Oct 21, 2019

Add possibility to create polyline with gradient color.

closes #486

..strokeWidth = polylineOpt.strokeWidth
..strokeCap = StrokeCap.round
..strokeJoin = StrokeJoin.round
..blendMode = BlendMode.src;

if (polylineOpt.gradientColors == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to also handle the isEmpty case

@johnpryan johnpryan merged commit f2377e2 into fleaflet:master Jan 7, 2020
ziuyung pushed a commit to SXTSOFT/flutter_map that referenced this pull request Mar 27, 2020
* master: (73 commits)
  去掉不要的
  Update CHANGELOG.md (fleaflet#511)
  Proj4dart update (fleaflet#541)
  Support custom CRS (fleaflet#529)
  docs(readme): add details about open street map provider (fleaflet#495)
  Wms support. (fleaflet#500)
  0.8.2 release
  polyline with gradient (fleaflet#452)
  clean up from fleaflet#487
  0.8.1 release
  Zoombutton plugin (fleaflet#487)
  dartfmt
  0.8.0 release (Flutter 1.12)
  Use Wrap for marker_anchor sample
  Polygon culling (fleaflet#449)
  Tidyup (fleaflet#469)
  Update build files from fleaflet#478
  upgrade flutter version, support Flutter 1.12
  Update README.md (fleaflet#465)
  add opacity option to tile layers (fleaflet#453)
  ...

# Conflicts:
#	example/android/app/build.gradle
#	example/android/app/src/debug/AndroidManifest.xml
#	example/android/app/src/main/AndroidManifest.xml
#	example/android/app/src/profile/AndroidManifest.xml
#	example/android/build.gradle
#	example/android/gradle.properties
#	example/ios/Runner.xcodeproj/project.pbxproj
#	example/lib/pages/home.dart
#	example/web/index.html
#	lib/flutter_map.dart
#	lib/src/geo/crs/crs.dart
#	lib/src/layer/overlay_image_layer.dart
#	lib/src/layer/tile_layer.dart
#	lib/src/layer/tile_provider/mbtiles_image_provider.dart
#	lib/src/map/flutter_map_state.dart
#	pubspec.yaml
@FilipeLarga
Copy link

@SebWojd Does this pr support using a gradient of only two colors over the whole line, instead of defining a color for every point? What does stop colors do? It is undocumented and not used in the example.

@SebWojd
Copy link
Contributor Author

SebWojd commented Jun 21, 2020

@FilipeLarga This feature support as many colors as you wish. You have to play with gradientColors and colorsStop. I implemented here the standard way how Dart use linear gradient.

Here you have a snippet:

PolylineLayerOptions(
                    polylines: [
                      Polyline(
                        points: pointsGradient,
                        strokeWidth: 4.0,
                        gradientColors: [
                          Color(0xffE40203),
                          Color(0xffFEED00),
                          Color(0xff007E2D),
                          Color(0xff0000FF),
                        ],
                        colorsStop: [
                          0.1,
                          0.3,
                          0.5,
                          0.95,
                        ],
                      ),
                    ],
                  ),

and the result is:

Zrzut ekranu 2020-06-21 o 13 08 18

@moovida
Copy link
Contributor

moovida commented Nov 10, 2020

Hi @SebWojd , sorry for resurrecting this here. I have an issue I am describing on issue #772
Is it possible that this works properly only for straight lines? Or is it supposed to work also for complex polylines?

@Vincent7140
Copy link

Hi @moovida , sorry for resurrecting this here. I have the same issue you had describing on issue #772

Did you manage to correct the issue since then ? thank you

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

Successfully merging this pull request may close these issues.

Does this package support gradient lines for polygons
5 participants