bramp / nine_patch

BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Destroys the whole asset shape #2

Open AhmadIzaz opened 1 month ago

AhmadIzaz commented 1 month ago

So I got the png from your give project textbox_side nad went to this website https://www.9patch.online/editor and created the 9 patch image of this png and this website gives me this 9 slice image textbox_side 9 and now when i run dart run nine_patcher path/to/the/.9.png/image and then it returns this error

`Unhandled exception: InvalidNinePatchException: 'No stretch area found along the top.'

0 findStretch (package:nine_patcher/src/image_decode.dart:115:5)

1 decodeNinePatchMetadata (package:nine_patcher/src/image_decode.dart:24:19)

2 new NinePatchImage.fromImage (package:nine_patcher/src/image.dart:18:22)

3 main (file:///Users/ahmadizaz/.pub-cache/hosted/pub.dev/nine_patcher-1.0.1/bin/nine_patcher.dart:65:29)

` Now Okay the error is self explanatory but whatever image I add, it always just gives the error. was not able to create .json file for once.
AhmadIzaz commented 1 month ago

Never mind, I used this https://romannurik.github.io/AndroidAssetStudio/nine-patches.html#source.type=image&sourceDensity=640&name=nine_primary_button for creating 9 patch image and then I used dart run nine_patcher and it did created the two files, json and the png file.

AhmadIzaz commented 1 month ago

But upon using this

Center(
          child: NinePatchImage.fromAssetMetadata(
              name: 'assets/nine_primary_button.9.json',
              margin: const EdgeInsets.all(5),
              padding: const EdgeInsets.all(5),
              child: const Text('This is my button')),
        ),

It destroyed the button :(

image

AhmadIzaz commented 1 month ago

It does stretch but destroyed the whole button layout

Original png image nine_primary_button

after

image

Here is the json

nine_primary_button.9.json