id
int64
393k
2.82B
repo
stringclasses
68 values
title
stringlengths
1
936
body
stringlengths
0
256k
labels
stringlengths
2
508
priority
stringclasses
3 values
severity
stringclasses
3 values
2,655,184,938
langchain
ChatLiteLLMRouter: Routing functionality is not working
### Checked other resources - [X] I added a very descriptive title to this issue. - [X] I searched the LangChain documentation with the integrated search. - [X] I used the GitHub search to find a similar question and didn't find it. - [X] I am sure that this is a bug in LangChain rather than my code. - [X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package). ### Example Code ``` import os from litellm import Router from litellm.router import RetryPolicy, AllowedFailsPolicy, AlertingConfig from langchain_community.chat_models import ChatLiteLLMRouter from langchain_core.globals import set_debug import langchain import litellm import boto3 from requests_aws4auth import AWS4Auth model_list = [ { "model_name": "small", "litellm_params": { "model": "bedrock/mistral.mistral-small-2402-v1:0", } }, { "model_name": "medium", "litellm_params": { "model": "bedrock/mistral.mistral-7b-instruct-v0:2", } }, { "model_name": "large", "litellm_params": { "model": "bedrock/mistral.mixtral-8x7b-instruct-v0:1", } } ] router = Router(model_list=model_list) chat = ChatLiteLLMRouter( model_name="large",router=router) chat.invoke("Describe LLM") ``` ### Error Message and Stack Trace (if applicable) AIMessage(content='\nAn LLM, or Master of Laws, is a postgraduate academic degree pursued by those holding a professional law degree, allowing them to specialize in a particular field of law or gain deeper understanding in multiple legal systems.', additional_kwargs={}, response_metadata={'token_usage': Usage(completion_tokens=48, prompt_tokens=14, total_tokens=62, completion_tokens_details=None, prompt_tokens_details=None), **'model_group': 'small', 'model_group_size': 1, 'deployment': 'bedrock/mistral.mistral-small-2402-v1:0',** 'model_info': {'id': 'a97f9695d3aa3def1701731164802172cbc2046d203ed5e1efebdb681bcfd2cc', 'db_model': False}, 'api_base': None, 'caching_groups': None, 'hidden_params': {'custom_llm_provider': 'bedrock', 'region_name': None, 'optional_params': {'temperature': 1.0}, 'model_id': 'a97f9695d3aa3def1701731164802172cbc2046d203ed5e1efebdb681bcfd2cc', 'api_base': None, 'response_cost': 0.000158, 'additional_headers': {}}, 'finish_reason': 'stop'}, id='run-7cf6dba8-919f-4115-a73e-01ee6dffa1bf-0') ### Description The routing for a specific model is not functioning, by default its taking the first model from the model list. We have configured three models here, small, medium and large. We have configured ChatLiteLLmRouter to use large, butit used first model in the list, which is small. In the source code litellm_router.py, its configured to select the first model from the model_list configuration. **self.model = self.router.model_list[0]["model_name"]** <img width="996" alt="image" src="https://github.com/user-attachments/assets/c087bbe1-9db8-4a69-90bd-1276d058566b"> ### System Info python -m langchain_core.sys_info System Information ------------------ > OS: Darwin > OS Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 > Python Version: 3.12.3 (v3.12.3:f6650f9ad7, Apr 9 2024, 08:18:47) [Clang 13.0.0 (clang-1300.0.29.30)] Package Information ------------------- > langchain_core: 0.3.15 > langchain: 0.3.7 > langchain_community: 0.3.5 > langsmith: 0.1.136 > langchain_aws: 0.2.3 > langchain_cohere: 0.3.1 > langchain_experimental: 0.3.2 > langchain_openai: 0.2.2 > langchain_text_splitters: 0.3.2 Optional packages not installed ------------------------------- > langgraph > langserve Other Dependencies ------------------ > aiohttp: 3.10.10 > async-timeout: Installed. No version info available. > boto3: 1.35.45 > cohere: 5.11.1 > dataclasses-json: 0.6.7 > httpx: 0.27.2 > httpx-sse: 0.4.0 > jsonpatch: 1.33 > numpy: 1.26.4 > openai: 1.54.3 > orjson: 3.10.7 > packaging: 24.1 > pandas: 2.2.3 > pydantic: 2.9.2 > pydantic-settings: 2.6.0 > PyYAML: 6.0.2 > requests: 2.32.3 > requests-toolbelt: 1.0.0 > SQLAlchemy: 2.0.35 > tabulate: 0.9.0 > tenacity: 8.5.0 > tiktoken: 0.8.0 > typing-extensions: 4.12.2
🤖:bug,Ɑ: core
low
Critical
2,655,200,347
pytorch
torch.jit.trace doesn't trace all operations completely (no data-dependent control flow)
### 🐛 Describe the bug Reproduce: ```python= class Model(torch.nn.Module): def __init__(self): super().__init__() self.register_buffer("accumulator", torch.tensor(np.zeros((dim1, dim2, dim3), dtype=np.float16))) def forward(self, x): self.accumulator += x output = self.accumulator * 2 self.accumulator = self.accumulator * self.accumulator return output torch_model = Model().eval() print(torch_model(torch.tensor([1]))) print(torch_model(torch.tensor([1]))) print(torch_model(torch.tensor([1]))) traced_model = torch.jit.trace(Model().eval(), torch.tensor([0])) print(traced_model(torch.tensor([1]))) print(traced_model(torch.tensor([1]))) print(traced_model(torch.tensor([1]))) ``` Output: ``` tensor([[[2.]]], dtype=torch.float16) tensor([[[4.]]], dtype=torch.float16) tensor([[[10.]]], dtype=torch.float16) tensor([[[2.]]], dtype=torch.float16) tensor([[[4.]]], dtype=torch.float16) tensor([[[6.]]], dtype=torch.float16) ``` torch.nn.Module works as expected but the traced model seems lose the operation `self.accumulator = self.accumulator * self.accumulator` because this operation isn't needed to compute output. ### Versions Collecting environment information... PyTorch version: 2.5.1 Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A OS: macOS 15.1 (arm64) GCC version: Could not collect Clang version: 16.0.0 (clang-1600.0.26.4) CMake version: version 3.24.0 Libc version: N/A Python version: 3.9.6 (default, Oct 4 2024, 08:01:31) [Clang 16.0.0 (clang-1600.0.26.4)] (64-bit runtime) Python platform: macOS-15.1-arm64-arm-64bit Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True CPU: Apple M2 Versions of relevant libraries: [pip3] numpy==2.0.1 [pip3] torch==2.5.1 [pip3] torchaudio==2.5.1 [pip3] torchvision==0.20.1 [conda] nomkl 3.0 0 [conda] numpy 1.21.5 py39h42add53_3 [conda] numpy-base 1.21.5 py39hadd41eb_3 [conda] numpydoc 1.2 pyhd3eb1b0_0 cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel
oncall: jit
low
Critical
2,655,269,629
next.js
Bug/inconsistency with `dynamicIO` and client-side hooks in dynamic segment
### Link to the code that reproduces this issue https://github.com/amannn/nextjs-bug-repro-dynamicio-client-hooks/commit/6f8f90deff9f2661d1dc6357db870405f983dbbb ### To Reproduce 1. Clone https://github.com/amannn/nextjs-bug-repro-dynamicio-client-hooks/ 2. Run `pnpm dev` and open e.g. http://localhost:300/en – works as expected 3. Run `pnpm build` – fails ### Current vs. Expected behavior I'm not sure what the expected behavior is, but at least aligning dev and prod seems like it should be the case. ### Provide environment information ```bash Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:00 PDT 2024; root:xnu-10063.141.2~1/RELEASE_X86_64 Available memory (MB): 16384 Available CPU cores: 12 Binaries: Node: 20.11.1 npm: 10.2.4 Yarn: 1.22.22 pnpm: 9.12.3 Relevant Packages: next: 15.0.4-canary.8 // Latest available version is detected (15.0.4-canary.8). eslint-config-next: 15.0.4-canary.8 react: 19.0.0-rc-5c56b873-20241107 react-dom: 19.0.0-rc-5c56b873-20241107 typescript: 5.6.3 Next.js Config: output: N/A ``` ### Which area(s) are affected? (Select all that apply) dynamicIO ### Which stage(s) are affected? (Select all that apply) next dev (local), next build (local) ### Additional context _No response_
bug,dynamicIO
low
Critical
2,655,276,120
transformers
TypeError: Accelerator.__init__() got an unexpected keyword argument 'dispatch_batches'
### System Info transformers==4.37.2 python 3 ### Who can help? _No response_ ### Information - [ ] The official example scripts - [X] My own modified scripts ### Tasks - [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...) - [X] My own task or dataset (give details below) ### Reproduction #huggingface trainer, to train the model from transformers import Trainer, TrainingArguments model.to(device) model_name = f"{model_ckpt}-finetuned" batch_size = 2 training_args = TrainingArguments( output_dir= model_name, save_safetensors = False, per_device_train_batch_size=batch_size, per_device_eval_batch_size=batch_size, evaluation_strategy='epoch', logging_strategy='epoch', learning_rate=1e-5, num_train_epochs=10, weight_decay=0.01, gradient_accumulation_steps=2, max_grad_norm=1.0, optim='adamw_torch' ) trainer = Trainer( model= model, args=training_args, train_dataset=train_dataset, eval_dataset=test_dataset, compute_metrics=compute_metrics ) trainer.train() ### Expected behavior I was run perfectly fun before Nov 12th midnight, and stop working on Nov 13th.....
bug,Accelerate
low
Critical
2,655,313,823
opencv
Tests are not validatable due to ONNXRuntime not supporting layout attiribute in LSTM
### System Information Operating System / Platform: MacOS ### Detailed description ONNXRuntime does not support `layout=1` inference. We have two tests that are designed to check funtionality of layout attribute see [[1](https://github.com/opencv/opencv/blob/67f07b16cbf7e556bc2d2861d8a586fe9e0f3fab/modules/dnn/test/test_onnx_importer.cpp#L1459)], [[2](https://github.com/opencv/opencv/blob/67f07b16cbf7e556bc2d2861d8a586fe9e0f3fab/modules/dnn/test/test_onnx_importer.cpp#L1466)]. The way these data and models for these test are generated using custom created LSTM class [[3](https://github.com/opencv/opencv_extra/blob/c2a02f61432621871112ba33c47fb0f24062d48a/testdata/dnn/onnx/generate_onnx_models.py#L1283)], which might differ form official ONNX implementation. As ONNXRuntime can not make inference, it is not obvious how to validete againts ONNXRuntime if the OpenCV performs well, as we do not have assess to reference from ONNXRutime. ```Error log 2024-11-13 16:23:06.229386 [E:onnxruntime:, inference_session.cc:2044 operator()] Exception during initialization: /Users/runner/work/1/s/onnxruntime/core/providers/cpu/rnn/lstm_base.h:53 onnxruntime::LSTMBase::LSTMBase(const onnxruntime::OpKernelInfo &) layout_ == 0 was false. Batchwise recurrent operations (layout == 1) are not supported. If you need support create a github issue with justification. ``` ### Steps to reproduce ```python mport numpy as np import onnx from onnx import helper if __name__ == "__main__": input = np.array([[[1.0, 2.0]], [[3.0, 4.0]], [[5.0, 6.0]]]).astype(np.float32) input_size = 2 hidden_size = 7 weight_scale = 0.3 number_of_gates = 4 layout = 1 # Create LSTM node node = onnx.helper.make_node( "LSTM", inputs=["X", "W", "R"], outputs=["Y", "Y_h"], hidden_size=hidden_size, layout=layout, ) # Create input tensors X = helper.make_tensor_value_info("X", onnx.TensorProto.FLOAT, [3, 1, input_size]) W = helper.make_tensor_value_info("W", onnx.TensorProto.FLOAT, [1, number_of_gates * hidden_size, input_size]) R = helper.make_tensor_value_info("R", onnx.TensorProto.FLOAT, [1, number_of_gates * hidden_size, hidden_size]) # Create output tensors Y = helper.make_tensor_value_info("Y", onnx.TensorProto.FLOAT, [3, 1, hidden_size]) Y_h = helper.make_tensor_value_info("Y_h", onnx.TensorProto.FLOAT, [1, 1, hidden_size]) # Generate random weights W_data = (np.random.rand(1, number_of_gates * hidden_size, input_size) * weight_scale).astype(np.float32) R_data = (np.random.rand(1, number_of_gates * hidden_size, hidden_size) * weight_scale).astype(np.float32) # Create initializers for weights W_tensor = helper.make_tensor( name="W", data_type=onnx.TensorProto.FLOAT, dims=[1, number_of_gates * hidden_size, input_size], vals=W_data.flatten().tolist() ) R_tensor = helper.make_tensor( name="R", data_type=onnx.TensorProto.FLOAT, dims=[1, number_of_gates * hidden_size, hidden_size], vals=R_data.flatten().tolist() ) # Create graph with initializers graph = helper.make_graph( [node], "lstm_test", [X, W, R], [Y, Y_h], initializer=[W_tensor, R_tensor] ) # Create model with specific opset version model = helper.make_model( graph, producer_name="lstm_layout_1", opset_imports=[helper.make_operatorsetid("", 14)] # Using opset 14 which is stable ) # Verify the model onnx.checker.check_model(model) # Save the model onnx.save(model, "lstm_layout_1.onnx") # Run the model using ONNX Runtime import onnxruntime as ort session = ort.InferenceSession("lstm_layout_1.onnx") outputs = session.run(None, {"X": input}) print("Output sequence:", outputs[0]) print("Final hidden state:", outputs[1]) ``` ### Issue submission checklist - [X] I report the issue, it's not a question - [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution - [X] I updated to the latest OpenCV version and the issue is still there - [X] There is reproducer code and related data files (videos, images, onnx, etc)
bug,category: dnn,category: dnn (onnx)
low
Critical
2,655,352,661
PowerToys
Mouse highlighter sometimes leaves lasting impression of primary button click
### Microsoft PowerToys version 0.86.0 ### Installation method PowerToys auto-update ### Running as admin No ### Area(s) with issue? Mouse Utilities ### Steps to reproduce I have configured the mouse highlighter to show the highlighter for the primary button (and secondary and always highlight). Radius is set to 40px, fade delay 250ms, fade duration 500ms. Sometimes the highlight for the primary button stays on screen forever instead of fading away (as shown in the screenshot). The highlight stays on the spot while I can move the mouse to other areas and generate other primary button impressions that do fade away. Unfortunately I'm not able to reproduce as it only happens from time to time. I think it may have to do with the screen going blank after a time out and when waking up the screen with the click of the mouse. I generally don't see this happening when I'm actively working on the screen. I have a dual monitor setup. I didn't pay attention to it yet but it may be only happening on my secondary monitor so a disabled screen and waking it up by generating a click on the second monitor. I'm able to clear the fixated highlight impression by turning off the highlight feature. Turning it back on, everything is normal again. ![Image](https://github.com/user-attachments/assets/03399355-7b62-4afa-a56d-1ba504fe534e) ### ✔️ Expected Behavior There should never be a fixated primary button highlight impression that stays on the screen ### ❌ Actual Behavior Once it appears, the fixated primary button highlight impression stays on the screen until the feature is turned off. ### Other Software _No response_
Issue-Bug,Needs-Triage
low
Major
2,655,370,332
pytorch
"Attribute arch of node cpu not found" error when running FSDP+TP on 8 H100s
### 🐛 Describe the bug When trying to run the [FSDP + TP official example](https://github.com/pytorch/examples/blob/main/distributed/tensor_parallelism/fsdp_tp_example.py) on a machine with 8 H100s or a [modified version of the code that uses the new FSDP2 api](https://gist.github.com/vturrisi/9ddfdfd6cbdd3ace177dad31135f3c86), we are getting the following error (that comes only from the last four GPUs): ``` [rank4]: Traceback (most recent call last): [rank4]: File "/mnt/task_runtime/main.py", line 143, in <module> [rank4]: model = parallelize_module( [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/tensor/parallel/api.py", line 112, in parallelize_module [rank4]: parallelize_module(submodule, device_mesh, parallelize_style) [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/tensor/parallel/api.py", line 85, in parallelize_module [rank4]: return parallelize_plan._apply(module, device_mesh) [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/tensor/parallel/style.py", line 269, in _apply [rank4]: return distribute_module( [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/tensor/_api.py", line 852, in distribute_module [rank4]: partition_fn(name, submod, device_mesh) [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/tensor/parallel/style.py", line 242, in _partition_embedding_fn [rank4]: dist_param = nn.Parameter(distribute_tensor(param, device_mesh, [Shard(0)])) [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/tensor/_api.py", line 735, in distribute_tensor [rank4]: local_tensor = placement._shard_tensor(local_tensor, device_mesh, idx) [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/tensor/placement_types.py", line 176, in _shard_tensor [rank4]: mesh_scatter(output, scatter_list, mesh, mesh_dim=mesh_dim) [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/tensor/_collective_utils.py", line 113, in mesh_scatter [rank4]: fut = scatter( [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/c10d_logger.py", line 83, in wrapper [rank4]: return func(*args, **kwargs) [rank4]: File "/miniconda/lib/python3.10/site-packages/torch/distributed/distributed_c10d.py", line 3718, in scatter [rank4]: work = group.scatter(output_tensors, input_tensors, opts) [rank4]: torch.distributed.DistBackendError: NCCL error in: /tmp/tmp.ASHKnc31xJ/pytorch/torch/csrc/distributed/c10d/NCCLUtils.hpp:317, internal error - please report this issue to the NCCL developers, NCCL version 2.19.1 [rank4]: ncclInternalError: Internal check failed. [rank4]: Last error: [rank4]: Attribute arch of node cpu not found ``` The same issue doesn't occur if using only the first four GPUs, but it always occurs when using all the GPUs, or including a subset of the last four. This command will work: ``` CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --nnodes=1 --nproc_per_node=4 --standalone fsdp_tp_example.py ``` While these won't work: ``` CUDA_VISIBLE_DEVICES=4,5,6,7 torchrun --nnodes=1 --nproc_per_node=4 --standalone fsdp_tp_example.py torchrun --nnodes=1 --nproc_per_node=6 --standalone fsdp_tp_example.py torchrun --nnodes=1 --nproc_per_node=8 --standalone fsdp_tp_example.py ``` ### Versions ``` PyTorch version: 2.5.1 Is debug build: False CUDA used to build PyTorch: 12.3 ROCM used to build PyTorch: N/A OS: Ubuntu 20.04.6 LTS (x86_64) GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 Clang version: Could not collect CMake version: version 3.30.5 Libc version: glibc-2.31 Python version: 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:36:39) [GCC 12.3.0] (64-bit runtime) Python platform: Linux-5.10.192-183.736.amzn2.x86_64-x86_64-with-glibc2.31 Is CUDA available: True CUDA runtime version: 12.3.107 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA H100 80GB HBM3 GPU 1: NVIDIA H100 80GB HBM3 GPU 2: NVIDIA H100 80GB HBM3 GPU 3: NVIDIA H100 80GB HBM3 GPU 4: NVIDIA H100 80GB HBM3 GPU 5: NVIDIA H100 80GB HBM3 GPU 6: NVIDIA H100 80GB HBM3 GPU 7: NVIDIA H100 80GB HBM3 Nvidia driver version: 535.129.03 cuDNN version: Probably one of the following: /usr/lib/x86_64-linux-gnu/libcudnn.so.9.5.1 /usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.5.1 /usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.5.1 /usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.5.1 /usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.5.1 /usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.5.1 /usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.5.1 /usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.5.1 HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 48 bits physical, 48 bits virtual CPU(s): 192 On-line CPU(s) list: 0-191 Thread(s) per core: 2 Core(s) per socket: 48 Socket(s): 2 NUMA node(s): 2 Vendor ID: AuthenticAMD CPU family: 25 Model: 1 Model name: AMD EPYC 7R13 Processor Stepping: 1 CPU MHz: 2031.335 BogoMIPS: 5300.00 Hypervisor vendor: KVM Virtualization type: full L1d cache: 3 MiB L1i cache: 3 MiB L2 cache: 48 MiB L3 cache: 384 MiB NUMA node0 CPU(s): 0-47,96-143 NUMA node1 CPU(s): 48-95,144-191 Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Mitigation; safe RET Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP always-on, RSB filling Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch topoext perfctr_core invpcid_single ssbd ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr rdpru wbnoinvd arat npt nrip_save vaes vpclmulqdq rdpid Versions of relevant libraries: [pip3] dctorch==0.1.2 [pip3] flake8==7.0.0 [pip3] mypy==1.11.2 [pip3] mypy-extensions==1.0.0 [pip3] numpy==1.26.4 [pip3] numpydoc==1.7.0 [pip3] optree==0.13.0 [pip3] parametrized_torchvision==0.0.1 [pip3] pytorch-lightning==2.4.0 [pip3] pytorch-msssim==1.0.0 [pip3] pytorchvideo==0.1.5 [pip3] torch==2.5.1 [pip3] torchaudio==2.5.0 [pip3] torchdiffeq==0.2.4 [pip3] torchlayers==0.1.1 [pip3] torchmetrics==1.5.1 [pip3] torchsde==0.2.6 [pip3] torchsummary==1.5.1 [pip3] torchvision==0.20.0 [pip3] triton==3.1.0 [conda] _anaconda_depends 2024.10 py310_mkl_0 [conda] blas 1.0 mkl [conda] dctorch 0.1.2 pypi_0 pypi [conda] magma-cuda121 2.6.1 1 pytorch [conda] mkl 2023.1.0 h213fc3f_46344 [conda] mkl-include 2025.0.0 pypi_0 pypi [conda] mkl-service 2.4.0 py310h5eee18b_1 [conda] mkl-static 2025.0.0 pypi_0 pypi [conda] mkl_fft 1.3.10 py310h5eee18b_0 [conda] mkl_random 1.2.7 py310h1128e8f_0 [conda] numpy 1.26.4 py310h5f9d8c6_0 [conda] numpy-base 1.26.4 py310hb5e798b_0 [conda] numpydoc 1.7.0 py310h06a4308_0 [conda] optree 0.13.0 pypi_0 pypi [conda] parametrized-torchvision 0.0.1 pypi_0 pypi [conda] pytorch-lightning 2.4.0 pypi_0 pypi [conda] pytorch-msssim 1.0.0 pypi_0 pypi [conda] pytorchvideo 0.1.5 pypi_0 pypi [conda] torch 2.5.1 pypi_0 pypi [conda] torchaudio 2.5.0 pypi_0 pypi [conda] torchdiffeq 0.2.4 pypi_0 pypi [conda] torchlayers 0.1.1 pypi_0 pypi [conda] torchmetrics 1.5.1 pypi_0 pypi [conda] torchsde 0.2.6 pypi_0 pypi [conda] torchsummary 1.5.1 pypi_0 pypi [conda] torchvision 0.20.0 pypi_0 pypi [conda] triton 3.1.0 pypi_0 pypi ``` cc @H-Huang @awgu @kwen2501 @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @c-p-i-o
oncall: distributed,release notes: distributed (fsdp2)
low
Critical
2,655,399,891
PowerToys
Put option in PowerToys Administrator > Run to allow processes to run elevated
### Description of the new feature / enhancement When running PowerToys as Administrator provide an option in PowerToys Run to launch elevated processes ### Scenario when this would be used? As a developer I sometime need to run tools like Visual Studio and Terminal as admin. The PT Run is so useful that it'd be great if it allowed this. ### Supporting information If the PT Administrator is not running as Admin then grey out this option. ![Image](https://github.com/user-attachments/assets/f8401aa6-28ae-4852-b8e9-786e6e3b6633)
Needs-Triage
low
Minor
2,655,456,537
terminal
Terminal Chat code-insert button sometimes inserts entirely commented-out code
### Windows Terminal version 1.23.3171.0 ### Windows build number 10.0.26120.0 ### Other Software * OpenAI * PowerShell 7 ### Steps to reproduce 1. Open Terminal Chat and provide a prompt which might result in multiple lines of code, such as "_connect to Exchange Online and list all mailboxes_". 2. Ensure the code starts with a comment (`#`). 3. Click the insert/copy icon next to the code block. ### Expected Behavior Possible options: * The insert button doesn't insert comments into the terminal; they are filtered out. * Line breaks are inserted so that single-line comments are "broken out of". * Comments aren't included in code blocks (i.e. the system prompt is modified to instruct the model not to include comments). ### Actual Behavior When there is multi-line code with a leading single-line comment inserted, the code (including comments) are inserted as all one line, meaning that the first comment comments out the entirety of the command, leaving no actual commands. The code can be manually modified to remove comments, but this greatly takes away from the convenience of just being able to click the code-insert button and have working code just run. ![Image](https://github.com/user-attachments/assets/bb1285e6-33ea-454e-b8a7-8c10cc2f24e6) ![Image](https://github.com/user-attachments/assets/bad60746-ed1a-41bf-a8a9-9bdae85fe45d)
Issue-Bug,Product-Terminal,Needs-Tag-Fix,Area-Chat
low
Critical
2,655,526,780
flutter
Adding Flutter module as a dependency in Module source code using KTS (Kotlin) in Android
### Steps to reproduce 1. Added these below line: ``` val filePath = settingsDir.parentFile.toString() + "/flutter_module/.android/include_flutter.groovy" apply(from = File(filePath)) ``` 2. Added `implementation(project(":flutter"))` in app level build.gradle 3. Try to build the android project 4. Getting below error: ```console Settings file '....../MyAndroidApp/settings.gradle.kts' line: 52 A problem occurred evaluating script. > Could not find method include() for arguments [:flutter] on build of type org.gradle.invocation.DefaultGradle. * Try: > 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. * Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating script. at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:137) ........ at org.gradle.internal.metaobject.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:184) at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:167) at org.gradle.invocation.DefaultGradle_Decorated.invokeMethod(Unknown Source) at include_flutter_eltw4w6gx4t4autcyhvv9vxk8.run(...../flutter_module/.android/include_flutter.groovy:4) at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91) ... 211 more ``` ### Expected results App should run normally after the setup as explained in below documentation: https://docs.flutter.dev/add-to-app/android/project-setup#depend-on-the-modules-source-code because this archive option https://docs.flutter.dev/add-to-app/android/project-setup#depend-on-the-android-archive-aar is working fine. ### Actual results Have error in Logs section ### Code sample <details open><summary>settings.gradle.kts looks like</summary> ```dart pluginManagement { repositories { google { content { includeGroupByRegex("com\\.android.*") includeGroupByRegex("com\\.google.*") includeGroupByRegex("androidx.*") } } mavenCentral() gradlePluginPortal() maven (url = "https://developer.huawei.com/repo/") maven (url = "https://s3.amazonaws.com/repo.commonsware.com") maven (url = "https://jitpack.io") maven (url = "https://jcenter.bintray.com/") } } @Suppress("UnstableApiUsage") dependencyResolutionManagement { repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS repositories { google() mavenCentral() maven (url = "https://developer.huawei.com/repo/") maven (url = "https://s3.amazonaws.com/repo.commonsware.com") maven (url = "https://jitpack.io") maven (url = "https://jcenter.bintray.com/") // maven { // url = uri("../flutter_module/build/host/outputs/repo") // metadataSources { // mavenPom() // } // } // maven { // url = uri("https://storage.googleapis.com/download.flutter.io") // } } } rootProject.name = "MyAndroidApp" include(":app") include(":common-utils") include(":common-layouts") include(":doc-scanner") include(":framework") val filePath = settingsDir.parentFile.toString() + "/flutter_module/.android/include_flutter.groovy" apply(from = File(filePath)) ``` </details> ### Screenshots or Video <details open> <summary>Screenshots / Video demonstration</summary> [Upload media here] </details> ### Logs <details open><summary>Logs</summary> ```console `Settings file '....../MyAndroidApp/settings.gradle.kts' line: 52 A problem occurred evaluating script. > Could not find method include() for arguments [:flutter] on build of type org.gradle.invocation.DefaultGradle. * Try: > 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. * Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating script. at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:137) at org.gradle.configuration.DefaultScriptTarget.addConfiguration(DefaultScriptTarget.java:74) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:140) at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47) at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:65) at org.gradle.internal.code.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44) at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:65) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyScript(DefaultObjectConfigurationAction.java:150) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$000(DefaultObjectConfigurationAction.java:43) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$1.run(DefaultObjectConfigurationAction.java:76) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:184) at org.gradle.kotlin.dsl.support.KotlinScriptHost.applyObjectConfigurationAction$kotlin_dsl(KotlinScriptHost.kt:137) at org.gradle.kotlin.dsl.support.PluginAwareScript.apply(PluginAwareScript.kt:38) at org.gradle.kotlin.dsl.support.CompiledKotlinSettingsScript.apply(CompiledKotlinSettingsScript.kt) at org.gradle.kotlin.dsl.PluginAwareExtensionsKt.apply(PluginAwareExtensions.kt:33) at org.gradle.kotlin.dsl.PluginAwareExtensionsKt.apply$default(PluginAwareExtensions.kt:31) at Settings_gradle.<init>(settings.gradle.kts:52) at Program.execute(Unknown Source) at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.eval(Interpreter.kt:514) at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.evaluateSecondStageOf(Interpreter.kt:443) at Program.execute(Unknown Source) at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.eval(Interpreter.kt:514) at org.gradle.kotlin.dsl.execution.Interpreter.eval(Interpreter.kt:213) at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator.evaluate(KotlinScriptEvaluator.kt:124) at org.gradle.kotlin.dsl.provider.KotlinScriptPluginFactory$create$1.invoke(KotlinScriptPluginFactory.kt:51) at org.gradle.kotlin.dsl.provider.KotlinScriptPluginFactory$create$1.invoke(KotlinScriptPluginFactory.kt:48) at org.gradle.kotlin.dsl.provider.KotlinScriptPlugin.apply(KotlinScriptPlugin.kt:35) at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47) at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:65) at org.gradle.internal.code.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44) at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:65) at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.applySettingsScript(ScriptEvaluatingSettingsProcessor.java:75) at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.process(ScriptEvaluatingSettingsProcessor.java:68) at org.gradle.initialization.SettingsEvaluatedCallbackFiringSettingsProcessor.process(SettingsEvaluatedCallbackFiringSettingsProcessor.java:34) at org.gradle.initialization.RootBuildCacheControllerSettingsProcessor.process(RootBuildCacheControllerSettingsProcessor.java:47) at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:49) at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:46) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53) at org.gradle.initialization.BuildOperationSettingsProcessor.process(BuildOperationSettingsProcessor.java:46) at org.gradle.initialization.DefaultSettingsLoader.findSettingsAndLoadIfAppropriate(DefaultSettingsLoader.java:143) at org.gradle.initialization.DefaultSettingsLoader.findAndLoadSettings(DefaultSettingsLoader.java:63) at org.gradle.initialization.SettingsAttachingSettingsLoader.findAndLoadSettings(SettingsAttachingSettingsLoader.java:33) at org.gradle.internal.composite.CommandLineIncludedBuildSettingsLoader.findAndLoadSettings(CommandLineIncludedBuildSettingsLoader.java:35) at org.gradle.internal.composite.ChildBuildRegisteringSettingsLoader.findAndLoadSettings(ChildBuildRegisteringSettingsLoader.java:44) at org.gradle.internal.composite.CompositeBuildSettingsLoader.findAndLoadSettings(CompositeBuildSettingsLoader.java:35) at org.gradle.initialization.InitScriptHandlingSettingsLoader.findAndLoadSettings(InitScriptHandlingSettingsLoader.java:33) at org.gradle.api.internal.initialization.CacheConfigurationsHandlingSettingsLoader.findAndLoadSettings(CacheConfigurationsHandlingSettingsLoader.java:36) at org.gradle.initialization.GradlePropertiesHandlingSettingsLoader.findAndLoadSettings(GradlePropertiesHandlingSettingsLoader.java:38) at org.gradle.initialization.DefaultSettingsPreparer.prepareSettings(DefaultSettingsPreparer.java:31) at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.doLoadBuild(BuildOperationFiringSettingsPreparer.java:71) at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.run(BuildOperationFiringSettingsPreparer.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47) at org.gradle.initialization.BuildOperationFiringSettingsPreparer.prepareSettings(BuildOperationFiringSettingsPreparer.java:54) at org.gradle.initialization.VintageBuildModelController.lambda$prepareSettings$1(VintageBuildModelController.java:80) at org.gradle.internal.model.StateTransitionController.lambda$doTransition$14(StateTransitionController.java:255) at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:266) at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:254) at org.gradle.internal.model.StateTransitionController.lambda$transitionIfNotPreviously$11(StateTransitionController.java:213) at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:34) at org.gradle.internal.model.StateTransitionController.transitionIfNotPreviously(StateTransitionController.java:209) at org.gradle.initialization.VintageBuildModelController.prepareSettings(VintageBuildModelController.java:80) at org.gradle.initialization.VintageBuildModelController.getLoadedSettings(VintageBuildModelController.java:57) at org.gradle.internal.model.StateTransitionController.lambda$notInState$3(StateTransitionController.java:132) at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44) at org.gradle.internal.model.StateTransitionController.notInState(StateTransitionController.java:128) at org.gradle.internal.build.DefaultBuildLifecycleController.loadSettings(DefaultBuildLifecycleController.java:118) at org.gradle.internal.build.AbstractBuildState.ensureProjectsLoaded(AbstractBuildState.java:116) at org.gradle.plugins.ide.internal.tooling.GradleBuildBuilder.create(GradleBuildBuilder.java:58) at org.gradle.plugins.ide.internal.tooling.GradleBuildBuilder.create(GradleBuildBuilder.java:38) at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildScopedBuilder.build(DefaultToolingModelBuilderRegistry.java:207) at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingBuilder$1.call(DefaultToolingModelBuilderRegistry.java:338) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53) at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingBuilder.build(DefaultToolingModelBuilderRegistry.java:335) at org.gradle.internal.build.DefaultBuildToolingModelController$AbstractToolingScope.getModel(DefaultBuildToolingModelController.java:83) at org.gradle.tooling.internal.provider.runner.DefaultBuildController.getModel(DefaultBuildController.java:116) at org.gradle.tooling.internal.consumer.connection.ParameterAwareBuildControllerAdapter.getModel(ParameterAwareBuildControllerAdapter.java:40) at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.getModel(UnparameterizedBuildController.java:116) at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.getModel(NestedActionAwareBuildControllerAdapter.java:32) at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.getModel(UnparameterizedBuildController.java:79) at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.getModel(NestedActionAwareBuildControllerAdapter.java:32) at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.getBuildModel(UnparameterizedBuildController.java:74) at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.getBuildModel(NestedActionAwareBuildControllerAdapter.java:32) at com.intellij.gradle.toolingExtension.impl.modelAction.GradleModelFetchAction.lambda$initAction$5(GradleModelFetchAction.java:181) at com.intellij.gradle.toolingExtension.impl.telemetry.GradleOpenTelemetry.callWithSpan(GradleOpenTelemetry.java:73) at com.intellij.gradle.toolingExtension.impl.telemetry.GradleOpenTelemetry.callWithSpan(GradleOpenTelemetry.java:61) at com.intellij.gradle.toolingExtension.impl.modelAction.GradleModelFetchAction.initAction(GradleModelFetchAction.java:180) at com.intellij.gradle.toolingExtension.impl.modelAction.GradleModelFetchAction.doExecute(GradleModelFetchAction.java:138) at com.intellij.gradle.toolingExtension.impl.modelAction.GradleModelFetchAction.lambda$execute$1(GradleModelFetchAction.java:103) at com.intellij.gradle.toolingExtension.impl.telemetry.GradleOpenTelemetry.callWithSpan(GradleOpenTelemetry.java:73) at com.intellij.gradle.toolingExtension.impl.telemetry.GradleOpenTelemetry.callWithSpan(GradleOpenTelemetry.java:61) at com.intellij.gradle.toolingExtension.impl.modelAction.GradleModelFetchAction.lambda$execute$2(GradleModelFetchAction.java:102) at com.intellij.gradle.toolingExtension.impl.modelAction.GradleModelFetchAction.withOpenTelemetry(GradleModelFetchAction.java:113) at com.intellij.gradle.toolingExtension.impl.modelAction.GradleModelFetchAction.lambda$execute$3(GradleModelFetchAction.java:101) at com.intellij.gradle.toolingExtension.impl.util.GradleExecutorServiceUtil.withSingleThreadExecutor(GradleExecutorServiceUtil.java:18) at com.intellij.gradle.toolingExtension.impl.modelAction.GradleModelFetchAction.execute(GradleModelFetchAction.java:100) at com.intellij.gradle.toolingExtension.impl.modelAction.GradleModelFetchAction.execute(GradleModelFetchAction.java:36) at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter.execute(InternalBuildActionAdapter.java:65) at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.executeAction(AbstractClientProvidedBuildActionRunner.java:109) at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.runAction(AbstractClientProvidedBuildActionRunner.java:97) at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.beforeTasks(AbstractClientProvidedBuildActionRunner.java:81) at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator.beforeTasks(DefaultBuildTreeModelCreator.java:43) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$fromBuildModel$2(DefaultBuildTreeLifecycleController.java:83) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$runBuild$4(DefaultBuildTreeLifecycleController.java:120) at org.gradle.internal.model.StateTransitionController.lambda$transition$6(StateTransitionController.java:169) at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:266) at org.gradle.internal.model.StateTransitionController.lambda$transition$7(StateTransitionController.java:169) at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44) at org.gradle.internal.model.StateTransitionController.transition(StateTransitionController.java:169) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.runBuild(DefaultBuildTreeLifecycleController.java:117) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.fromBuildModel(DefaultBuildTreeLifecycleController.java:82) at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner.runClientAction(AbstractClientProvidedBuildActionRunner.java:43) at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner.run(ClientProvidedPhasedActionRunner.java:59) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.internal.buildtree.ProblemReportingBuildActionRunner.run(ProblemReportingBuildActionRunner.java:49) at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:65) at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:140) at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41) at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.lambda$execute$0(RootBuildLifecycleBuildActionExecutor.java:40) at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:130) at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.execute(RootBuildLifecycleBuildActionExecutor.java:40) at org.gradle.internal.buildtree.InitDeprecationLoggingActionExecutor.execute(InitDeprecationLoggingActionExecutor.java:62) at org.gradle.internal.buildtree.InitProblems.execute(InitProblems.java:36) at org.gradle.internal.buildtree.DefaultBuildTreeContext.execute(DefaultBuildTreeContext.java:40) at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.lambda$execute$0(BuildTreeLifecycleBuildActionExecutor.java:71) at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:60) at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.execute(BuildTreeLifecycleBuildActionExecutor.java:71) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:61) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:57) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor.execute(RunAsBuildOperationBuildActionExecutor.java:57) at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.lambda$execute$0(RunAsWorkerThreadBuildActionExecutor.java:36) at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:267) at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:131) at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.execute(RunAsWorkerThreadBuildActionExecutor.java:36) at org.gradle.tooling.internal.provider.continuous.ContinuousBuildActionExecutor.execute(ContinuousBuildActionExecutor.java:110) at org.gradle.tooling.internal.provider.SubscribableBuildActionExecutor.execute(SubscribableBuildActionExecutor.java:64) at org.gradle.internal.session.DefaultBuildSessionContext.execute(DefaultBuildSessionContext.java:46) at org.gradle.internal.buildprocess.execution.BuildSessionLifecycleBuildActionExecutor$ActionImpl.apply(BuildSessionLifecycleBuildActionExecutor.java:92) at org.gradle.internal.buildprocess.execution.BuildSessionLifecycleBuildActionExecutor$ActionImpl.apply(BuildSessionLifecycleBuildActionExecutor.java:80) at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:71) at org.gradle.internal.buildprocess.execution.BuildSessionLifecycleBuildActionExecutor.execute(BuildSessionLifecycleBuildActionExecutor.java:62) at org.gradle.internal.buildprocess.execution.BuildSessionLifecycleBuildActionExecutor.execute(BuildSessionLifecycleBuildActionExecutor.java:41) at org.gradle.internal.buildprocess.execution.StartParamsValidatingActionExecutor.execute(StartParamsValidatingActionExecutor.java:64) at org.gradle.internal.buildprocess.execution.StartParamsValidatingActionExecutor.execute(StartParamsValidatingActionExecutor.java:32) at org.gradle.internal.buildprocess.execution.SessionFailureReportingActionExecutor.execute(SessionFailureReportingActionExecutor.java:51) at org.gradle.internal.buildprocess.execution.SessionFailureReportingActionExecutor.execute(SessionFailureReportingActionExecutor.java:39) at org.gradle.internal.buildprocess.execution.SetupLoggingActionExecutor.execute(SetupLoggingActionExecutor.java:47) at org.gradle.internal.buildprocess.execution.SetupLoggingActionExecutor.execute(SetupLoggingActionExecutor.java:31) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:70) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.lambda$execute$0(ForwardClientInput.java:40) at org.gradle.internal.daemon.clientinput.ClientInputForwarder.forwardInput(ClientInputForwarder.java:80) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:64) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52) at org.gradle.launcher.daemon.server.DaemonStateCoordinator.lambda$runCommand$0(DaemonStateCoordinator.java:320) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48) Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method include() for arguments [:flutter] on build of type org.gradle.invocation.DefaultGradle. at org.gradle.internal.metaobject.AbstractDynamicObject$CustomMissingMethodExecutionFailed.<init>(AbstractDynamicObject.java:190) at org.gradle.internal.metaobject.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:184) at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:167) at org.gradle.invocation.DefaultGradle_Decorated.invokeMethod(Unknown Source) at include_flutter_eltw4w6gx4t4autcyhvv9vxk8.run(...../flutter_module/.android/include_flutter.groovy:4) at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91) ... 211 more ``` </details> ### Flutter Doctor output <details open><summary>Doctor output</summary> ```console (base) misbah@LTP20 flutter_module % flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel beta, 3.27.0-0.1.pre, on macOS 14.3.1 23D60 darwin-x64, locale en-AE) [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [!] Xcode - develop for iOS and macOS (Xcode 15.4) ✗ Unable to get list of installed Simulator runtimes. ! CocoaPods 1.11.2 out of date (1.13.0 is recommended). CocoaPods is a package manager for iOS or macOS platform code. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/to/platform-plugins To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods [✓] Chrome - develop for the web [✓] Android Studio (version 2024.2) [✓] VS Code (version 1.95.2) [✓] Connected device (3 available) [✓] Network resources ! Doctor found issues in 1 category. ``` </details>
platform-android,tool,t: gradle,a: existing-apps,has reproducible steps,P1,workaround available,team-android,triaged-android,found in release: 3.24,found in release: 3.27
medium
Critical
2,655,579,139
kubernetes
Support arrays and slices in `NestedFieldNoCopy`
Hello! 👋 I'm doing a Kube State Metrics' [Custom Resource State](https://github.com/kubernetes/kube-state-metrics/blob/main/docs/metrics/extend/customresourcestate-metrics.md) rewrite as an operator, which [employs](https://github.com/rexagod/crsm/commit/d8e3ab572e606c265abc7c7042960f6de7256ef6) `*unstructured.Unstructured`'s string-based resolving `NestedFieldNoCopy` API. However, it seems that the API currently lacks support for [slices and arrays](https://github.com/kubernetes/apimachinery/blob/v0.31.0/pkg/apis/meta/v1/unstructured/helpers_test.go#L121C21-L121C38), and I was wondering if there are any plans to do this in the future, or if the SIG would be open to a patch addressing the same?
sig/api-machinery,kind/feature,triage/accepted
low
Major
2,655,598,109
flutter
Height of TextField decreases when using OutlineInputBorder and label
### Steps to reproduce 1. Run the provided code example using border type UnderlineInputBorder as enabledBorder. Notice that the height adapts to the height of the SizedBox. 2. Change the border type from UnderlineInputBorder to OutlineInputBorder, and the height will decrease. 3. Note: this only seems to be reproducable if the TextField has a label. When removing the label, the height doesn't change when switching border types. Only tested on Linux desktop. ### Expected results When changing the enabledBorder of InputDecoration from UnderlineInputBorder to OutlineInputBorder, I expect the height of the TextField to stay the same (200). ### Actual results The height decreases when changing from UnderlineInputBorder to OutlineInputBorder. ### Code sample <details open><summary>Code sample</summary> ```dart void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: const MyHomePage(), ); } } class MyHomePage extends StatelessWidget { const MyHomePage({super.key}); @override Widget build(BuildContext context) { return const Scaffold( body: Center( child: SizedBox( width: 300, height: 200, child: TextField( decoration: InputDecoration( fillColor: Color.fromARGB(255, 142, 163, 118), filled: true, label: Text('Label'), enabledBorder: OutlineInputBorder( borderSide: BorderSide( color: Color.fromARGB(255, 79, 92, 64), ), ), contentPadding: EdgeInsets.symmetric(vertical: 20, horizontal: 10), ), ), ), ), ); } } ``` </details> ### Screenshots or Video <details open> <summary>Screenshots / Video demonstration</summary> [Upload media here] </details> ### Logs <details open><summary>Logs</summary> ```console [Paste your logs here] ``` </details> ### Flutter Doctor output <details open><summary>Doctor output</summary> ```console [✓] Flutter (Channel stable, 3.24.3, on Ubuntu 22.04.4 LTS 6.8.0-48-generic, locale en_US.UTF-8) • Flutter version 3.24.3 on channel stable at /home/lier/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2663184aa7 (9 weeks ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3 [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/to/linux-android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use `flutter config --android-sdk` to update to that location. [✓] Chrome - develop for the web • Chrome at google-chrome [✓] Linux toolchain - develop for Linux desktop • Ubuntu clang version 14.0.0-1ubuntu1.1 • cmake version 3.22.1 • ninja version 1.10.1 • pkg-config version 0.29.2 [!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/to/linux-android-setup for detailed instructions). [✓] VS Code (version 1.95.1) • VS Code at /snap/code/current/usr/share/code • Flutter extension version 3.100.0 [✓] Connected device (2 available) • Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.4 LTS 6.8.0-48-generic • Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.119 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 2 categories. ``` </details>
a: text input,framework,f: material design,has reproducible steps,P2,team-text-input,triaged-text-input,found in release: 3.24,found in release: 3.27
low
Minor
2,655,662,863
deno
deno fmt crash
Version: ``` deno 2.0.6 (stable, release, x86_64-unknown-linux-gnu) v8 12.9.202.13-rusty typescript 5.6.2 ``` I created a new backstage app via `npx @backstage/create-app@latest` and tried to run `deno fmt` against it and it exits with code `137` and prints "Killed" It was a chore trying to find out exactly which file was causing the error but it was `.yarn/releases/yarn-4.4.1.cjs` I'm writing this one as a bug because deno crashes but feel like there could also be a couple of feature requests that come from this as well. Rather than preemptively creating them and generating noise I'll leave them here for discussion. If they look good feel free to create new Bug issues out of them linking back here. # deno fmt doesn't identify the file it fails on Not entirely sure where the `Killed` message is coming from, but if deno knows which file caused an error it should be printed to the console. To find the file causing problems I had to run this: ```bash for fname in $(git ls-tree -r HEAD --name-only); do echo $fname; deno fmt $fname; done ``` Perhaps a `--verbose` flag could help as well rather than leaving users in the dark or resorting to something like the above script. # option to piggy-back on //prettier-ignore Perhaps not by default, but maybe there should be an option to ignore files with `//prettier-ignore` as well as `// deno-fmt-ignore-file`
deno fmt,needs investigation
low
Critical
2,655,749,068
next.js
@import on CSS file not working when i use Turbopack
### Link to the code that reproduces this issue https://codesandbox.io/p/devbox/elegant-hodgkin-jrwltm?workspaceId=90948d01-dfc4-44b7-a979-f689d697bccf ### To Reproduce I'm trying to import radix colors on my css file in a new Next 15 Project, but is not working (when i disable turbopack works fine): When there's just the colors: ![image](https://github.com/user-attachments/assets/6bb5610e-1412-4eba-a198-48443975d54f) The error on compile is: "./src/app/globals.css:42:2 Module not found: Can't resolve '@radix-ui/colors/violet-dark-alpha'" When i have Tailwind at the top: ![image](https://github.com/user-attachments/assets/7be51fab-af23-4ad1-b7e6-82414973fe2f) The error changes to: ![image](https://github.com/user-attachments/assets/8dc32dbf-7a0f-4bac-b53a-c68d18b429de) ### Current vs. Expected behavior Without turbopack works fine: ![image](https://github.com/user-attachments/assets/4c82ff7d-323f-4183-9623-94bc5be214e8) ### Provide environment information ```bash Operating System: Platform: Ubuntu 24.04 Binaries: Node: 20.14.0 bun: 1.1.34 (using only the package manager) Relevant Packages: "next": "15.0.3", "react": "19.0.0-rc-66855b96-20241106", "react-dom": "19.0.0-rc-66855b96-20241106" ``` ### Which area(s) are affected? (Select all that apply) Turbopack ### Which stage(s) are affected? (Select all that apply) next dev (local) ### Additional context _No response_
bug,Turbopack,linear: turbopack
low
Critical
2,655,768,418
yt-dlp
Support password vaults (macOS Keychain, KDE Wallet, GNOME Keyring) for credentials
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE - [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field ### Checklist - [X] I'm requesting a feature unrelated to a specific site - [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme) - [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels)) - [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) ### Provide a description that is worded well enough to be understood `yt-dlp` supports a number of authorization options: ``` Authentication Options: -u, --username USERNAME Login with this account ID -p, --password PASSWORD Account password. If this option is left out, yt-dlp will ask interactively -2, --twofactor TWOFACTOR Two-factor authentication code -n, --netrc Use .netrc authentication data --netrc-location PATH Location of .netrc authentication data; either the path or its containing directory. Defaults to ~/.netrc --netrc-cmd NETRC_CMD Command to execute to get the credentials for an extractor. --video-password PASSWORD Video-specific password --ap-mso MSO Adobe Pass multiple-system operator (TV provider) identifier, use --ap-list-mso for a list of available MSOs --ap-username USERNAME Multiple-system operator account login --ap-password PASSWORD Multiple-system operator account password. If this option is left out, yt-dlp will ask interactively --ap-list-mso List all supported multiple-system operators --client-certificate CERTFILE Path to client certificate file in PEM format. May include the private key --client-certificate-key KEYFILE Path to private key file for client certificate --client-certificate-password PASSWORD ``` However, it doesn't support a native password vaults: macOS Keychain, Gnome Keyring, KDE Wallet. I propose to support a way to store authorization credentials in a popular vaults. Many applications already support storing passwords in these vaults: `git` [^1], `mbsync` [^2], `msmtp` [^3] and so on. There is a Python keyring library that provides an easy way to access the system keyring service from python. It can be used in any application that needs safe password storage. [^4] [^0]: https://specifications.freedesktop.org/secret-service/latest/ [^1]: https://git-scm.com/docs/gitcredentials [^2]: https://isync.sourceforge.io/mbsync.html [^3]: https://marlam.de/msmtp/msmtp.html#Authentication [^4]: https://pypi.org/project/keyring/ ### Provide verbose output that clearly demonstrates the problem - [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`) - [X] If using API, add `'verbose': True` to `YoutubeDL` params instead - [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below ### Complete Verbose Output ```shell [0] ~ $ yt-dlp -vU [debug] Command-line config: ['-vU'] [debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8 [debug] yt-dlp version stable@2024.09.27 from yt-dlp/yt-dlp [c6387abc1] (pip) [debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-6.8.0-48-generic-x86_64-with-glibc2.35 (OpenSSL 3.0.2 15 Mar 2022, glibc 2.35) [debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2, rtmpdump 2.4 [debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, pyxattr-0.7.2, requests-2.32.3, secretstorage-3.3.1, sqlite3-3.37.2, urllib3-1.26.18, websockets-13.1 [debug] Proxy map: {'moz_disable_wayland': '1'} [debug] Request Handlers: urllib, requests, websockets [debug] Loaded 1838 extractors [debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest ``` ```
enhancement,triage
low
Critical
2,655,798,505
kubernetes
Device Plugin "ContainerAllocationResponse" mounts symbolic links incorrectly, it mounts them as directories.
### What would you like to be added? Hi The device plug-in's "ContainerAllocationResponse" has: Mounts []*[Mount](https://pkg.go.dev/k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1#Mount) Mounts object contains a list is files/folders to mount to a container during the allocation. I have a use case where I need to mount a "symbolic link" from the host to the container "/dev" directory, unfortunately the kubelet passes it as a directory to the container not as a "symbolic link". Is there a way to tell the Device Plugin that mounts it as a Symbolic Link? Thanks in advance for any help you can provide me. ### Why is this needed? Both /dev and /sys are strongly related to each other regarding drivers hardware communication; this relationship usually is materialized as "symbolic links". Some drivers looks for the devices using the "/dev" symbolic links, and relies on "readlinks" to extract information. When the symbolic links are loss (during the mount) the drivers gets broken inside the container.
sig/node,kind/feature,needs-triage
low
Critical
2,655,855,122
angular
Mention the inject method in Injection Token page
### Describe the problem that you experienced The Injection Token documentation still only has one way to inject a token, could we mention the `inject()` method ? https://angular.dev/guide/di/dependency-injection-providers#using-an-injectiontoken-object ### Enter the URL of the topic with the problem https://angular.dev/guide/di/dependency-injection-providers#using-an-injectiontoken-object ### Describe what you were looking for in the documentation We can read : ```typescript export class AppComponent { constructor(@Inject(APP_CONFIG) config: AppConfig) { this.title = config.title; } } ``` We could add / replace this snippet with : ```typescript @Component({* // omitted for brevity template: `<div>{{ config.myProperty }}</div>` }) export class AppComponent { config = inject(APP_CONFIG); } ``` ### Describe the actions that led you to experience the problem The point is to keep the documentation up to date and not having to wonder if it's possible or not, and having to read some web articles to check. ### Describe what you want to experience that would fix the problem _No response_ ### Add a screenshot if that helps illustrate the problem _No response_ ### If this problem caused an exception or error, please paste it here ```true ``` ### If the problem is browser-specific, please specify the device, OS, browser, and version ```true ``` ### Provide any additional information here in as much as detail as you can ```true ```
area: docs
low
Critical
2,655,873,996
go
x/build: windows installer doesn't allow installing on removable media
### Go version go version go1.23.3 windows/amd64 ### Output of `go env` in your module/workspace: ```shell N/A (Not installed) ``` ### What did you do? Downloaded Windows AMD64 installer package (MSI) on both my laptop and a VPS. Installing on laptop to HDD or SSD works fine while hitting a snag on the virtual machine. Tried installing it to any of the drives, including C: which is the system partition on a VirtIO instance (SCSI/SAS), and just for laughs to see if they would work, network storage slabs (also run through VirtIO). Looked up permissions issues which it seems to not be. ### What did you see happen? Error saying it needs to be installed on a HDD, which of course a Virtio instance is not. ### What did you expect to see? It to install as if it's on a physical machine. Is this a bogus error message from the installer, or is it actually hard coded not to work on any partition hanging off of a non-SATA (i.e. USB or network) drive? There should be an option to bypass this if it's the boot drive if it's intentional. It's a strange requirement in this age. I assume that using the ZIP version and just manually adding the paths would work fine, as a workaround. Editing the MSI file's scripts would also fix it but that's more of an intermediate level of skill to do.
OS-Windows,NeedsInvestigation
low
Critical
2,655,876,655
flutter
[flutter_svg] Text Support
_Imported from https://github.com/dnfield/flutter_svg/issues/7_ Original report by @dnfield on May 3, 2018 Basic text support is achievable: - [x] Basic support for rendering text with a fill property (or, if text only has stroke property, treating the stroke as a fill) - [x] Support the x, y (single value), dx and dy properties - [x] Support nested tspans with various styles - [x] Support font inheritence properties These might be achievable as-is but not clear on their value here: - [ ] Multi-value x/y lists - but is this really a desired functionality? - [ ] The rotate property - really necessary though? Would likely require lots of canvas manipulation. Not easy to implement. These would require engine level changes/patches: - [ ] `<textPath>` support - Flutter only supports drawing text in a straight line today. Issue opened for that to discuss in flutter/flutter - [x] Stroke text. (See https://github.com/flutter/engine/pull/5395) - [x] Otherwise painted text. (see https://github.com/flutter/engine/pull/5395) - [ ] Custom kerning - probably not a good idea here. All of that said, it may be preferable to preprocess text into paths with another tool. --- Comment by @dnfield on Jun 26, 2018 x/y and dx/dy are very non-trivial to implement. I may revisit if inspiration hits (or if someone else wants to try they're welcome), but unless I see some need for it I'll likely focus on other areas. I do still think textPath would be nice to have, but will require an update to Engine to achieve. --- Comment by @Tyxz on Apr 16, 2019 I know svg text is still under development, but I miss a point on your todo list: colored text. For my night theme I tried to change to color to the normal text color. The svg circle gets colored, but the text stays black. ```Dart SvgPicture.asset( S.of(context).asset_circle_text, color: Theme.of(context) .primaryTextTheme .display1 .color, ) ``` ![Black text with white circle](https://user-images.githubusercontent.com/7293989/56241722-de277700-6096-11e9-8083-2953fee335ca.png) Besides that, great work. I did not find a way to bend the text like that directly with Flutter, but thanks to you it looks very nice in the day theme. --- Comment by @dnfield on Apr 16, 2019 What happens if you do `BlendMode.screen` for the blending? --- Comment by @Tyxz on Apr 17, 2019 Sadly, still no difference. It could be unrelated to your library and due to the way my SVG is build. I created it with Illustrator and minified it with the svgcleaner app and the result looks like this: ```SVG <svg viewBox="0 0 1009.36 1009.36" xmlns="http://www.w3.org/2000/svg"> <circle cx="504.68" cy="504.68" fill="none" r="425" stroke="#000" stroke-miterlimit="10" stroke-width="3"/> <g font-family="Roboto-Regular, Roboto"> <text font-size="58.085369" transform="matrix(.48 -.88 .88 .48 96.51 302.45)">A</text> <text font-size="58.085369" transform="matrix(.55 -.84 .84 .55 114.47 269.91)">n</text> <text font-size="58.085369" transform="matrix(.59 -.81 .81 .59 131.81 243.62)">t</text> <text font-size="58.085369" transform="matrix(.62 -.78 .78 .62 142.87 228.61)">i</text> <text font-size="58.085369" transform="matrix(.66 -.75 .75 .66 151.13 217.81)">c</text> <text font-size="58.085369" transform="matrix(.69 -.72 .72 .69 170.93 195.34)">i</text> <text font-size="58.085369" transform="matrix(.73 -.69 .69 .73 180.15 185.35)">p</text> <text font-size="58.085369" transform="matrix(.77 -.64 .64 .77 203.33 163.4)">a</text> <text font-size="58.085369" transform="matrix(.8 -.59 .59 .8 227.4 143.74)">t</text> <text font-size="58.085369" transform="matrix(.83 -.56 .56 .83 242.4 132.73)">i</text> <text font-size="58.085369" transform="matrix(.85 -.52 .52 .85 253.46 124.85)">o</text> <text font-size="58.085369" transform="matrix(.89 -.46 .46 .89 281.14 107.92)">n</text> </g> </svg> ``` EDIT: Interesting enough, if I add a ```fill="white"``` to the ```<g>``` element, and set the blend mode to screen, the text gets painted black, independend of the set color in the SvgPicture. --- Comment by @mtc-jed on Apr 11, 2022 Hi, just adding this to the pile of stuff : the font-family "Tahoma" isn't taken into account. Is this because Tahoma isn't supported ? If so, how can I add it to the font list ? <details> <summary>SVG code</summary> ```svg <svg viewBox="0 0 24 24"> <circle cx="12" cy="12" r="11" style="fill:none;stroke:#757575;stroke-width:2" /> <text x="5.9619141" y="18.561035" font-size="18px" font-weight="bold" font-family="Tahoma" fill="#757575" >1</text> </svg> ``` </details> --- Comment by @dnfield on Apr 11, 2022 The font family attribute is supported, but the font must be available on the user device to use it.
package,team-engine,p: flutter_svg
low
Minor
2,655,881,200
flutter
[flutter_svg] Dashed path support
_Imported from https://github.com/dnfield/flutter_svg/issues/9_ Original report by @dnfield on May 3, 2018 (should be done in the path library) - [x] Support non-percentage dash-offset - [ ] Support percentage based dash-offsets --- Comment by @dnfield on May 9, 2018 Initial support in ed4dc94 Doesn't yet support dashed paths with percentages in the dash array. I'm not 100% sure of the best way to implement this, particularly since by the spec it's acutally viewport percentage rather than path length percentage - I'm inclined right now to not implement it until/unless I see a compelling example of it being needed.
package,team-engine,p: flutter_svg
low
Minor
2,655,881,352
flutter
[flutter_svg] Improve caching
_Imported from https://github.com/dnfield/flutter_svg/issues/21_ Original report by @dnfield on Jun 12, 2018 - [ ] Make caching depend on picture size rather than number of pictures; depends on flutter/engine#5378 - [ ] Make caching strategy injectable/swappable --- Comment by @ravenblackx on Sep 11, 2020 I would suggest that there's an inherent issue with the assumptions of the implementation of SvgPicture's cache - it's optimized for an svg that doesn't expect to change, such that if we do a fade animation on an svg, it reloads the asset for every frame of the animation, and caches the output of the newly colored render. What we usually want is for the base image to be loaded and cached, and then for each render apply the color tint. (We rarely move an svg, and frequently color-fade them.) Optionally it could cache both the base image and the tinted image, but caching only the part we don't reuse, and reloading and rerendering from scratch for every color-frame is a really weird behavior that won't be great for performance. There are four layers it could cache at: 1. cache the loaded data, so we only load once. There is ~never a need to invalidate this (maybe if it came from network such that the file might change). 2. cache some kind of pre-parsed loaded data, the `Picture`, in Dart terms. There is never a need to invalidate this, but I'm not sure if there's an appropriate storage structure for it because it's not using a `Picture`. Maybe the `DrawableRoot`? 3. cache the rendered base image. This is invalidated if we change size. 4. cache the rendered colored image. This is invalidated if we change size or color. I believe the SvgPicture implementation uses option 4, and only option 4, so if we animate fading between color values then for each frame we reload, reparse, rerender, reapply the tint, cache that image, and finally paint it onto the display one time. (I haven't dug into it super deeply; the reason I believe option 4 is what's happening is that in a unit test, if you change the color of an svg you have to waitForPendingImages to get a subsequent screenshot to show the updated color, which implies that some out-of-process operation is happening. We can get the same effect by wrapping an uncolored svg in a ColorFiltered widget, which allows for animating the color without waitForPendingImages, which is approximately equivalent to using caching option 3.) --- Comment by @dnfield on Sep 11, 2020 You're right that there are a bunch of problems here, but you might want to consider just using a `ColorFilter` widget around the `SvgPicture` rather than providing a color/color filter parameter to the SVG.
package,team-engine,p: flutter_svg
low
Major
2,655,881,502
flutter
[flutter_svg] Text doesn't render in correct location
_Imported from https://github.com/dnfield/flutter_svg/issues/36_ Original report by @wendux on Jul 19, 2018 Thanks your job! I find a problem of this library. When I load the follow svg file from network, it doesn't work. svg link: https://camo.githubusercontent.com/956078561b010d309faad6f271afede2344f556f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d666c757474657225374364617274253230766d2d6666363962342e7376673f7374796c653d666c61742d737175617265 ![svg](https://camo.githubusercontent.com/956078561b010d309faad6f271afede2344f556f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d666c757474657225374364617274253230766d2d6666363962342e7376673f7374796c653d666c61742d737175617265) The file content is: ```html <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="150" height="20"> <g shape-rendering="crispEdges"> <path fill="#555" d="M0 0h57v20H0z"/> <path fill="#ff69b4" d="M57 0h93v20H57z"/> </g> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="295" y="140" transform="scale(.1)" textLength="470">platform</text> <text x="1025" y="140" transform="scale(.1)" textLength="830">flutter|dart vm</text> </g> </svg> ``` when I change the content to: ```html <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="150" height="20" viewBox="0 0 150 20"> <g shape-rendering="crispEdges"> <path fill="#555" d="M0 0h57v20H0z"/> <path fill="#ff69b4" d="M57 0h93v20H57z"/> </g> <g fill="#fff" text-anchor="start" font-family="Verdana" font-size="11"> <text x="5" y="14" textLength="47">platform</text> <text x="70" y="14" textLength="83">flutter|dart vm</text> </g> </svg> ``` I use `SvgPicture.string` to render the widget with above code, it works, but But the relationship among `x`,`y`,`textLength` and `transform` is not clear. --- Comment by @dnfield on Jul 19, 2018 Text support is not great at this point. I'll take a look but it's likely due to that. --- Comment by @dnfield on Jul 23, 2018 Yes, this is entirely due to the x/y stuff for text. It's not very well supported at this point and I'm not sure if/when it will be (the logic to properly support it is fairly convoluted at this point, and I'm not sure how much benefit will really be derived from it). I'll leave this open for now to track, but don't have an ETA to fix. --- Comment by @SteveAlexander on Dec 30, 2018 I'd like to display some floorplans in an app for a conference. The floorplans are in SVG format — here is an example: https://d7vxxpq42vr68.cloudfront.net/2018/m2020-us/floorplans/375698-752672.svg The shapes render fine, even for the more complex maps. But, as described here, the text doesn't work. Any thoughts on whether this is something that will be looked at over the next month or two? --- Comment by @SteveAlexander on Dec 30, 2018 just tried @krispyen's PR branch — works great for my purposes: https://github.com/krispypen/flutter_svg.git --- Comment by @dnfield on Dec 31, 2018 I've merged in that patch, but it doesn't quite fix this issue locally - will leave open for now. --- Comment by @dnfield on Dec 31, 2018 Ok, cleaned up a bit in https://github.com/dnfield/flutter_svg/pull/95 - which is now published as v0.9.0+1 It's still definitely not perfect, but much improved. --- Comment by @Drkstr on Aug 27, 2019 Hey everyone, Where can I find some example code for setting text values in SVGs? --- Comment by @deandreamatias on Jun 11, 2022 This still a issue? --- Comment by @Huber1 on Jun 27, 2023 yes. I have the same Problem when Parsing a svg from my local transport. The Svg is this one: ```svg <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Ebene_1" viewBox="0 0 1000 500" xml:space="preserve"><script xmlns=""/> <rect fill="#C79514" width="1000" height="500"/> <text text-anchor="middle" x="50%" y="50%" dy=".35em" font-family="Arial, sans-serif" font-weight="bold" font-size="425px" fill="#ffffff">21</text> <style xmlns="" class="darkreader darkreader--fallback">html, body, body :not(iframe) { background-color: #232425 !important; border-color: #777067 !important; color: #dddcd9 !important; }</style></svg> ``` Location: https://www.mvv-muenchen.de/fileadmin/lines/02021.svg ![Screenshot_20230627-112424](https://github.com/dnfield/flutter_svg/assets/22856090/16db7b35-b845-4fea-880e-ab89ec0ee49c) The Text is not, as expected centered vertically and horizontally, but only centered horizontally Is it a coincidence that the bottom line of the text is centered? EDIT: The Image is not cropped. I put it in a Center on a blank screen to make sure it is completely visible
package,p: flutter_svg
low
Minor
2,655,881,661
flutter
[flutter_svg] Add (some) support for blur effect
_Imported from https://github.com/dnfield/flutter_svg/issues/53_ Original report by @sroddy on Sep 4, 2018 Hi, this is an SVG that we would like to be able to render using this library. [friends_emoji.svg.zip](https://github.com/dnfield/flutter_svg/files/2349528/friends_emoji.svg.zip) The only thing that is not visibly rendered correctly are the shadows, which use a blur effect. @dnfield can you please take a look on the file and tell me if you see anything that at the moment can't be rendered due to current Flutter rendering limitations? We are considering to put some of our efforts on this and fill a PR to add support. Thank you a lot --- Comment by @dnfield on Sep 10, 2018 FilterEffects are currently unimplemented at all. In theory they should all be possible, but I haven't put much thought into how they'd work out in Flutter. This does seem related to https://github.com/flutter/flutter/issues/13489 - although this should be a bit simpler than that one (and may even point to some help on that one). It seems like it should be possible to just apply an `ImageFilter` to a `Paint` with some changes to the engine, and that may be more performant than building a whole new layer object for it. --- Comment by @dnfield on Sep 18, 2018 So looking at this a little more, I don't think you'd even really need an `ImageFilter` - `MaskFilter`, which is already implemented, should be good enough. --- Comment by @liri2006 on Sep 7, 2019 Any news on this one? Would be great to have shadows support :) --- Comment by @rohit901 on Oct 6, 2019 could you please do something about this, our app needs to use a colored svg but it is not being rendered. --- Comment by @dnfield on Oct 22, 2019 So I can stop downloading this each time I come back here: ```svg <svg xmlns="http://www.w3.org/2000/svg" width="95" height="108" fill="none"> <defs> <filter id="filter0_d" width="53.163" height="53.297" x="41.837" y="15.748" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"> <feFlood flood-opacity="0" result="BackgroundImageFix"/> <feColorMatrix in="SourceAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/> <feOffset dx="4"/> <feGaussianBlur stdDeviation="4"/> <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/> <feBlend in2="BackgroundImageFix" result="effect1_dropShadow"/> <feBlend in="SourceGraphic" in2="effect1_dropShadow" result="shape"/> </filter> <filter id="filter1_d" width="62.247" height="62.414" x=".223" y="0" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"> <feFlood flood-opacity="0" result="BackgroundImageFix"/> <feColorMatrix in="SourceAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/> <feOffset dx="4"/> <feGaussianBlur stdDeviation="4"/> <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/> <feBlend in2="BackgroundImageFix" result="effect1_dropShadow"/> <feBlend in="SourceGraphic" in2="effect1_dropShadow" result="shape"/> </filter> <filter id="filter2_d" width="68.854" height="69.045" x="8.803" y="38.955" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"> <feFlood flood-opacity="0" result="BackgroundImageFix"/> <feColorMatrix in="SourceAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/> <feOffset dx="4"/> <feGaussianBlur stdDeviation="4"/> <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/> <feBlend in2="BackgroundImageFix" result="effect1_dropShadow"/> <feBlend in="SourceGraphic" in2="effect1_dropShadow" result="shape"/> </filter> <linearGradient id="paint0_linear" x1="64.418" x2="64.418" y1="23.748" y2="61.045" gradientUnits="userSpaceOnUse"> <stop stop-color="#FFE354"/> <stop offset="1" stop-color="#E9C93C"/> </linearGradient> <linearGradient id="paint1_linear" x1="64.412" x2="64.412" y1="46.474" y2="50.552" gradientUnits="userSpaceOnUse"> <stop stop-color="#fff"/> <stop offset="1" stop-color="#CDCDCD"/> </linearGradient> <linearGradient id="paint2_linear" x1="27.346" x2="27.346" y1="8" y2="54.414" gradientUnits="userSpaceOnUse"> <stop stop-color="#FFE354"/> <stop offset="1" stop-color="#E9C93C"/> </linearGradient> <linearGradient id="paint3_linear" x1="39.23" x2="39.23" y1="46.955" y2="100" gradientUnits="userSpaceOnUse"> <stop stop-color="#FFE354"/> <stop offset="1" stop-color="#E9C93C"/> </linearGradient> </defs> <path fill="url(#paint0_linear)" d="M64.418 61.045C74.681 61.045 83 52.695 83 42.396c0-10.299-8.32-18.648-18.582-18.648s-18.581 8.349-18.581 18.648c0 10.3 8.32 18.649 18.581 18.649z" filter="url(#filter0_d)"/> <path fill="#000" d="M55.45 45.474a.894.894 0 0 0-.906.835.902.902 0 0 0 .08.442 10.796 10.796 0 0 0 3.974 4.59 10.741 10.741 0 0 0 11.629 0 10.797 10.797 0 0 0 3.974-4.59.902.902 0 0 0-.826-1.277H55.45z"/> <path fill="url(#paint1_linear)" fill-rule="evenodd" d="M73.527 48c.25-.4.476-.817.674-1.25a.9.9 0 0 0-.826-1.276H55.45a.891.891 0 0 0-.764.41.9.9 0 0 0-.062.867c.198.432.423.85.673 1.249h18.23z" clip-rule="evenodd"/> <path fill="#F24E53" d="M50.482 45.643a2.329 2.329 0 0 0 2.325-2.333 2.329 2.329 0 0 0-2.325-2.333 2.329 2.329 0 0 0-2.324 2.333 2.329 2.329 0 0 0 2.324 2.333zM78.355 45.643a2.329 2.329 0 0 0 2.324-2.333 2.329 2.329 0 0 0-2.324-2.333 2.329 2.329 0 0 0-2.325 2.333 2.329 2.329 0 0 0 2.325 2.333z" opacity=".5"/> <path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.325" d="M68.482 38.495c1.994-.828 4.129-.729 6.388 0M60.351 38.495c-1.99-.828-4.129-.729-6.388 0"/> <path fill="url(#paint2_linear)" d="M27.346 54.414c12.771 0 23.124-10.39 23.124-23.207S40.117 8 27.346 8C14.576 8 4.223 18.39 4.223 31.207s10.352 23.207 23.123 23.207z" filter="url(#filter1_d)"/> <path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.896" d="M15.892 23.731l5.566 3.987-6.652 3.394M38.8 23.731l-5.57 3.987 6.657 3.394"/> <path fill="#6793FD" d="M8.17 34.675c-.948.54-2.07.683-3.123.396a4.132 4.132 0 0 1-2.494-1.927 4.157 4.157 0 0 1-.416-3.131 4.143 4.143 0 0 1 1.904-2.516c2.329-1.351 6.301-.995 8.176-.73a.85.85 0 0 1 .728.786.856.856 0 0 1-.06.38c-.705 1.76-2.386 5.39-4.715 6.742z" opacity=".8"/> <path stroke="#C2EDFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.088" d="M7.885 27.92a7.725 7.725 0 0 0-3.088.828 3.002 3.002 0 0 0-1.363 1.6" opacity=".8"/> <path fill="#6793FD" d="M46.498 34.675a4.119 4.119 0 0 0 5.664-1.503 4.154 4.154 0 0 0-1.535-5.675c-2.329-1.351-6.301-.995-8.176-.73a.849.849 0 0 0-.729.786.858.858 0 0 0 .06.38c.706 1.76 2.387 5.39 4.716 6.742z" opacity=".8"/> <path stroke="#C2EDFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.088" d="M46.782 27.92a7.725 7.725 0 0 1 3.09.828c.63.351 1.115.92 1.362 1.6" opacity=".8"/> <path fill="#000" d="M16.185 36.284a1.112 1.112 0 0 0-.944.512 1.122 1.122 0 0 0-.076 1.075 13.438 13.438 0 0 0 4.946 5.711 13.369 13.369 0 0 0 14.47 0 13.438 13.438 0 0 0 4.947-5.711 1.123 1.123 0 0 0-.483-1.453 1.112 1.112 0 0 0-.537-.134H16.185z"/> <path fill="#F24E53" fill-rule="evenodd" d="M33.722 44.091a10.183 10.183 0 0 0-6.376-2.225c-2.414 0-4.632.833-6.375 2.225a13.365 13.365 0 0 0 12.751 0z" clip-rule="evenodd"/> <path fill="url(#paint3_linear)" d="M39.23 100c14.596 0 26.427-11.874 26.427-26.522 0-14.648-11.831-26.523-26.427-26.523-14.595 0-26.427 11.875-26.427 26.523S24.635 100 39.23 100z" filter="url(#filter2_d)"/> <path fill="#000" d="M25.021 71.256a1.484 1.484 0 0 0-1.465 1.265c-.036.233-.016.472.057.695 2.577 7.791 8.598 13.262 15.617 13.262 7.02 0 13.036-5.466 15.613-13.262a1.497 1.497 0 0 0-.733-1.795 1.484 1.484 0 0 0-.675-.165H25.02z"/> <path fill="#F24E53" fill-rule="evenodd" d="M48.602 82.857a13.578 13.578 0 0 0-9.372-3.74 13.578 13.578 0 0 0-9.372 3.74c2.684 2.287 5.906 3.62 9.372 3.62 3.467 0 6.689-1.332 9.372-3.62z" clip-rule="evenodd"/> <path fill="#F24E53" d="M19.236 78.45a3.31 3.31 0 0 0 3.303-3.315 3.31 3.31 0 0 0-3.303-3.315 3.31 3.31 0 0 0-3.304 3.315 3.31 3.31 0 0 0 3.304 3.316zM59.225 78.45a3.31 3.31 0 0 0 3.303-3.315 3.31 3.31 0 0 0-3.303-3.315 3.31 3.31 0 0 0-3.304 3.315 3.31 3.31 0 0 0 3.304 3.316z" opacity=".5"/> <path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.309" d="M33.45 66.018c-.587-2.395-2.396-4.144-4.543-4.144-2.147 0-3.96 1.749-4.542 4.144M54.095 66.018c-.586-2.395-2.395-4.144-4.542-4.144s-3.96 1.749-4.542 4.144"/> </svg> ``` I believe everything that's needed for this is now available in the engine. Going to take another stab at it. --- Comment by @JSBmanD on Dec 24, 2019 Any updates about this feature? --- Comment by @dnfield on Dec 24, 2019 I started on this at one point and haven't had time to get back to it. It's not entirely simple, but should be doable. I'd be happy to review a pr for it if someone else gets to it before me. --- Comment by @szadrutsky on Feb 13, 2020 Doesnt work for me either In Chrome this works perfectly and rendered with the shadow. [nflx_graph.svg.zip](https://github.com/dnfield/flutter_svg/files/4196733/nflx_graph.svg.zip) --- Comment by @mohammadne on Mar 18, 2020 any update ? --- Comment by @KenHoang16CDTH12 on May 7, 2020 I have same issues. I need solution. --- Comment by @alectogeek on Aug 8, 2020 Any updates here? ______ Is there another way do draw shadow behind SVG picture in Flutter? Should I convert it to the canvas path and draw the shadow or is there any easier way? Or maybe there is another library? Thanks --- Comment by @dnfield on Aug 8, 2020 I started working on support for this at one point but it has a lot of quirks to support. It should be possible but I have no estimate of when. You could do a drawShadow on the canvas below decoded svg for sure though. --- Comment by @Whale-Street on Sep 1, 2020 > Is there another way do draw shadow behind SVG picture in Flutter? Crappy workaround that I'm using: converting shadows to bitmap. --- Comment by @rupamking1 on Dec 18, 2020 I understood this issue is duplicate but please tell me when you make shadow feature in svg plugin. --- Comment by @dnfield on Dec 18, 2020 I'll provide an example when I'm back at my computer :) --- Comment by @dnfield on Dec 18, 2020 Hmm. I'm realizing this might be something to add as a feature rather than expecting people to do it themselves as I work through it. Part of the problem with supporting filter elements is that there's many many combinations that are valid and they become somewhat difficult to handle correctly outside of pretty simple cases. It's a solvable problem but not one I've had time to get to. And a couple people who really wanted this just went ahead and implemented drop shadows themselves. I think it'd be reasonably easy to just add some kind of shadow property to the widget for people who want drop shadows though. The only thing is that may cause confusion if or when the package starts supporting filter elements that also do shadows. --- Comment by @rupamking1 on Dec 18, 2020 Yes your Package fans are waiting for This Feature. --- Comment by @rupamking1 on Dec 20, 2020 If I use multiple shadow components in Svg in different area, so how flutter shadow help us ? Please use Android native is SVG plugin and joint it with your plugin and please solve Shadow problem. --- Comment by @oguibueno on Mar 18, 2021 Any news on that? --- Comment by @gfb-47 on Mar 24, 2021 Any updates? --- Comment by @gfb-47 on Mar 25, 2021 I kinda solved this using [Flutter Shape Maker](https://fluttershapemaker.com/), once my SVG wasn't working on this package, I just converted it into a flutter "draw" using this site. It worked just fine. Edit: Btw, I developed my SVG and got the code on [Method Draw](https://editor.method.ac/). --- Comment by @Vasilisk7 on Aug 19, 2021 Same problem --- Comment by @rupamking1 on Aug 19, 2021 I think flutter_svg author @dnfield never want to fix this problem. --- Comment by @dnfield on Aug 19, 2021 It's not so much that I don't want to, as that it's a relatively complicated feature to properly support and I haven't had much time to get to it. I'm happy to review patches that support it. --- Comment by @ArefMozafari on Sep 22, 2021 Hey there Thank you so much for this fabulous package. Here's what I get: `Unhandled element filter; Picture key: StringPicture(String#bcac4, colorFilter: null)` Since there are so many SVG assets in my project, I am not sure which of them should be replaced with the correct version of its own. Using breakpoints did not help either. My app displays this immediately upon opening in logs, but it doesn't break anything or cause a crash. --- Comment by @ArefMozafari on Sep 26, 2021 > Hey there > Thank you so much for this fabulous package. > Here's what I get: > `Unhandled element filter; Picture key: StringPicture(String#bcac4, colorFilter: null)` > Since there are so many SVG assets in my project, I am not sure which of them should be replaced with the correct version of its own. > Using breakpoints did not help either. > My app displays this immediately upon opening in logs, but it doesn't break anything or cause a crash. Nothing so far? --- Comment by @om-ha on Oct 17, 2021 Hey everyone, I summarized all the points regarding this issue into this [StackOverflow answer here](https://stackoverflow.com/a/69604101/10830091). @dnfield Thanks for the awesome plugin! 1. I would like to ask you what your are thoughts regarding `filter` and effects/blur svg element support. If they are not going to be supported at all, then maybe mentioning this in Readme or something would be useful? 2. I noticed there's a use for the `filter` svg element in an example within this repo: https://github.com/dnfield/flutter_svg/blob/master/example/assets/simple/width_height_viewbox.svg?short_path=99658b9#L8 --- Comment by @dnfield on Oct 18, 2021 This is a feature I'd like to implement or see implemented. It's also unfortunately something I rarely have time to work on. Some day, I will probably have time for this again. But someone else might implement it. This is already listed as a TODO in the readme, but if there's some other way to make things clearer I don't mind. --- Comment by @om-ha on Oct 19, 2021 Sound quite reasonable. Thanks for trying to work on this in the past and sharing some ideas on how to successfully implement this. Regarding implementing SVG Filter Effects elements in `flutter_svg` package, here is everything I could gather related to implementing this feature. Now I am no expert in this, but I fumbled my way around it. I think it shows how complex this feature is: ### References - 1 What are SVG Filter Effects? - 1.1 [MSDN](https://developer.mozilla.org/en- US/docs/Web/SVG/Tutorial/Filter_effects) - 1.2 [Wikipedia](https://en.wikipedia.org/wiki/SVG_filter_effects) - 2 Implementing this feature is not trivial to be done **[efficiently](https://github.com/dnfield/flutter_svg/issues/478#issuecomment-766952953)**. - 3 `MaskFilter` - 3.1 This could be used to implement this feature. As the package author suggested [here](https://github.com/dnfield/flutter_svg/issues/53#issuecomment-419826617) and [here](https://github.com/dnfield/flutter_svg/issues/53#issuecomment-422262470). - 3.2 Official [`MaskFilter` docs](https://api.flutter.dev/flutter/dart-ui/MaskFilter-class.html). ### Points to consider - 4 Be ready to navigate following topics: - 4.1 SVG specification - 4.2 Flutter [framework](https://github.com/flutter/flutter) and Flutter [engine](https://github.com/flutter/engine) - 4.3 Maybe the underlying [Skia engine](https://skia.org/docs/dev/flutter/). - 5 Implementation ideas - 5.1 `MaskFilter` - 5.1.1 According to Wikipedia, SVG Filter Effects are defined as: **A filter effect consists of a series of graphics operations that are applied to a given source vector graphic to produce a modified bitmapped result.** - 5.1.2 `MaskFilter` as per flutter docs is defined as: **A mask filter to apply to shapes as they are painted. A mask filter is a function that takes a bitmap of color pixels, and returns another bitmap of color pixels.** - 5.1.3 Theoretically, `MaskFilter` can be used to convert an **input bitmap** representing the SVG obtained from `flutter_svg`, into another output bitmap by applying relevant `SVG Filter Primitives` depending on the specifications defined by parsed SVG. These primitives are finite so covering them should successfully implement `filter` element in this package. - 5.2 SVG Filter Effects element & CSS Filter property - 5.2.1 It's possible to embed SVG filter effects within CSS as [demonstrated here](https://www.stefanjudis.com/today-i-learned/svgs-filters-can-be-inlined-in-css/) and mentioned in this [MSDN docs](https://developer.mozilla.org/en-US/docs/Web/CSS/filter#svg_filter). - 5.2.2 It looks like someone in flutter engine got CSS filter effects to work for web-ui, I'm not sure what to make of this but here it is: [source](https://github.com/flutter/engine/blob/b95484ed0d139263213d00e417819926df84edcd/lib/web_ui/lib/src/engine/html/backdrop_filter.dart#L82). - 5.2.3 It seems this flutter's web-ui source I just linked mentions something called [`Filter Effects Module Level 2`](https://drafts.fxtf.org/filter-effects-2/) which talks about `Filter Effects` for SVG & CSS within the web, it might be worth checking this out for better understanding or implementation ideas. This looks like a recipe book on how to implement various Filter Effect primitive operators. There's also the older [`Filter Effects Module Level 1`](https://drafts.fxtf.org/filter-effects-1/). **I think point 5.1 above is the most important one in implementing this feature.** I will try to update this comment with any new resources I come by. I could be wrong in some points so please point them out. --- Comment by @ayoubm on Jan 24, 2022 Or use this widget to wrap your SvgPicture asset: https://pub.dev/packages/simple_shadow ! Works perfectly fine ! --- Comment by @Pedanfer on May 1, 2022 I solved this by downloading as PDF from Figma and trying multiple converters online, because I imagined they use different code for generating the SVG. Most did it with filter tags. Finally, I found one that didn´t use `<filter>`, and it works now. Users of the app can now rejoice with the crisp definition the SVG provides. https://products.aspose.app/pdf/es/conversion/pdf-to-svg --- Comment by @bartekpacia on Dec 7, 2022 @dnfield Is it possible to disable printing "unhandler element filter" to the console? I'd very much like to be able to do this. I see it's coming from [the vector_graphics package](https://github.com/dnfield/vector_graphics), from [here](https://github.com/dnfield/vector_graphics/blob/183bd5c63c9f7e5ba39e318b6709156b5a3b70a3/packages/vector_graphics_compiler/lib/src/svg/parser.dart#L893-L907). --- Comment by @ugurberkecan on Dec 12, 2022 Make sure that your SVG file does not contain any defs elements. If it does, you can try removing them from the file and see if that fixes the issue. --- Comment by @bartekpacia on Dec 12, 2022 @ugurberkecan Yeah, I know that, but I'm asking about shutting down the logs completely. In general, I'm not a fan of packages calling `print()`, this makes it impossible to configure their log output to your own needs. --- Comment by @ugurberkecan on Dec 12, 2022 @bartekpacia I tried to answer main question in this thread so I don't know your question. --- Comment by @bartekpacia on Dec 12, 2022 Ah, okay. I didn't want to be mean, sorry :) --- Comment by @SeriousMonk on Jan 15, 2023 I don't mean to sound ungreatful, because this package is great, but the issue was opened 5 years ago and there still is no support for blur. The drop shadows in my logo are being rendered horribly. Is there anything in the works regarding this? Or should I stick to pngs. --- Comment by @dnfield on Jan 17, 2023 Unfortunately, the way the spec is written this feature is _very_ difficult to implement in any kind of performant way. I've been more focused on improving performance in general before trying to implement this. Flutter was also missing some features that made implementing this feature more difficult - those features are available now and it should be more possible to implement this. That said, I'm still hesitant. The most common usage I've seen of this feature is to add a drop shadow. There are usually better ways to do that than what the implementation of this feature would be required to do. --- Comment by @dnfield on Jan 17, 2023 To add a little more detail: The way the spec is written, filters often require multiple render target switches to get right. It can be difficult (expensive) to determine whether an RT switch can be elided by the parser. RT switches are very expensive on mobile GPUs. Doing a lot of them will make your app very slow. --- Comment by @fisforfaheem on Sep 16, 2023 please try --- Comment by @SakshamKarnawat on Nov 9, 2023 I keep coming across issues related to SVGs in Flutter. Working with SVGs in Flutter is a huge pain. Hope this is fixed someday. --- Comment by @escamoteur on Jul 18, 2024 could this be easier supported if the svgs get precomiled? --- Comment by @fisforfaheem on Jul 22, 2024 Kindly add Full supporT FInally
package,p: flutter_svg
low
Critical
2,655,881,978
flutter
[flutter_svg] Specifying `viewBox`, `width`, and `height` leads to incorrect stroke-width and font-size rendering
_Imported from https://github.com/dnfield/flutter_svg/issues/62_ Original report by @SteveAlexander on Sep 10, 2018 Sketch produced this SVG. It renders in Sketch like this: ![image](https://user-images.githubusercontent.com/4321921/45322107-31ed4300-b53f-11e8-9eff-796f24dc95dd.png) It renders in Chrome like this: ![image](https://user-images.githubusercontent.com/4321921/45322134-45001300-b53f-11e8-9ed8-3552b10c43ad.png) It renders in Flutter like this: ![image](https://user-images.githubusercontent.com/4321921/45322146-4fbaa800-b53f-11e8-9cf6-ea7a141350fb.png) If I go into the SVG code and reduce the element id Filter's stroke-width from 4 to 3, it looks like this: ![image](https://user-images.githubusercontent.com/4321921/45322202-7e388300-b53f-11e8-9012-ad848bf59ab8.png) ... which looks more like the other renderers do. I wonder if somehow flutter_svg is adding one to the stroke width? ``` <?xml version="1.0" encoding="UTF-8"?> <svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 51.2 (57519) - http://www.bohemiancoding.com/sketch --> <title>Close</title> <desc>Created with Sketch.</desc> <defs></defs> <g id="03.-Agenda" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="square"> <g id="Filter" transform="translate(-338.000000, -22.000000)" stroke="#1A1A1A" stroke-width="4"> <g id="Close" transform="translate(347.000000, 31.000000) rotate(-45.000000) translate(-347.000000, -31.000000) translate(339.000000, 23.000000)"> <path d="M0,8 L16,8" id="Line-2"></path> <path d="M8,0 L8,16" id="Line-2"></path> </g> </g> </g> </svg> ``` --- Comment by @dnfield on Sep 11, 2018 Not entirely sure why this is happening yet iwth just a quick look, but it does seem off. Will continue to investigate. --- Comment by @dnfield on Oct 7, 2018 I haven't spent a ton of time looking at this, but I'm a little puzzled by it. The width is definitely coming out as 4. I suspect something funny might be going on with the transforms, although translate/rotate shouldn't make it appear bigger. --- Comment by @dnfield on Oct 7, 2018 It has something to do with the width and height attributes. The way flutter_svg works is if there's a viewBox, it ignores width and height. If you take width and height off this SVG, it renders the same as flutter_svg and in Chrome. Checking spec.... --- Comment by @dnfield on Oct 7, 2018 Relevant part of spec: > Unlike the ‘transform’ attribute (see effect of the ‘transform’ on sibling attributes), the automatic transformation that is created due to a ‘viewBox’ does not affect the ‘x’, ‘y’, ‘width’ and ‘height’ attributes (or in the case of the ‘marker’ element, the ‘markerWidth’ and ‘markerHeight’ attributes) on the element with the ‘viewBox’ attribute. Thus, in the example above which shows an ‘svg’ element which has attributes ‘width’, ‘height’ and ‘viewBox’, the ‘width’ and ‘height’ attributes represent values in the coordinate system that exists before the ‘viewBox’ transformation is applied. On the other hand, like the ‘transform’ attribute, it does establish a new coordinate system for all other attributes and for descendant elements. It's not immediately obvious to me how to properly support this. Some kind of scaling needs to be done, but I'm having trouble grasping the correct formula here (and also whether I've just made it impossible the way I'm (mis)using viewBox/width/height to make things fill the widget size). I'll have to think about it some more. --- Comment by @dnfield on Oct 7, 2018 The basic issue seems to be there needs to be some special handling for stroke widths and font sizes in this scenario. --- Comment by @dnfield on Nov 5, 2018 I think I finally figured this one out. Hoping to have a fix soon. --- Comment by @dnfield on Nov 5, 2018 This is now fixed on master (d8e2b82) and I'm contemplating releasing it as v0.7.0, but I'd really like to hear your feedback about whether it's working the way you want it to. There was a bug in the way I handled width/height previously. I've corrected that, but it's a breaking change for anyone who was specifying width/height and wanted it to be that way. My inclination is to go forward with this since it's closer to the spec, but I'm a little concerned about making lots of users upset that their SVGs no longer render correctly. Let me know what you think. --- Comment by @SteveAlexander on Nov 22, 2018 Initial feedback: I have some work to do on my icons, or in my app, in order to accommodate the changes. For example, the icons below align fine with the released version of flutter_svg, but are off-centre now. ![image](https://user-images.githubusercontent.com/4321921/48911693-57fe6000-ee6b-11e8-90e9-0303393493a1.png) Next, I'll look into why that might be. Probably some combination of the SVGs we are using, and the way we're using them in our layout. Personally, and on behalf of my team, we're very happy to make changes when the reason is an overall better system. --- Comment by @SteveAlexander on Nov 22, 2018 Ok, seems that the area flutter_svg claims for the widget is twice as wide as the SVG wants to be. ``` <?xml version="1.0" encoding="UTF-8"?> <svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 51.2 (57519) - http://www.bohemiancoding.com/sketch --> <title>Fill 1</title> <desc>Created with Sketch.</desc> <defs></defs> <g id="02.-Agenda" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="Agenda" transform="translate(-37.000000, -629.000000)" fill="#FFFFFF"> <g id="Tab-bar" transform="translate(0.000000, 611.000000)"> <polygon id="Fill-1" points="48 18 37 25.7 37 40 44.5 40 44.5 33.3989 51.5 33.3989 51.5 40 59 40 59 25.7"></polygon> </g> </g> </g> </svg> ``` ![image](https://user-images.githubusercontent.com/4321921/48913618-cc87cd80-ee70-11e8-8b6c-6be91011e6bb.png) --- Comment by @SteveAlexander on Nov 22, 2018 Here's a thin one and a broader one, for comparison. ![image](https://user-images.githubusercontent.com/4321921/48913644-dd384380-ee70-11e8-80dd-27cc8858faf0.png) ![image](https://user-images.githubusercontent.com/4321921/48913649-e1646100-ee70-11e8-80d5-129ee1359186.png) --- Comment by @dnfield on Nov 22, 2018 Yes, this is expected now. I think it conforms to the spec more closely this way, but I'm not sure if it's really better for flutter specifically. What do you think? In general you probably don't want to explicitly set a width or height on a svg for use in Flutter. --- Comment by @SteveAlexander on Nov 22, 2018 I'm not understanding how the width of the widget in flutter is twice as wide as the SVG. Is that what the spec wants? --- Comment by @dnfield on Nov 22, 2018 If you specify the width of the svg, it's going to be the actual width of the drawing in pixels. --- Comment by @SteveAlexander on Nov 22, 2018 the code that renders these is: ``` return SvgPicture.string( snapshot.data, color: iconColor, colorBlendMode: BlendMode.multiply, allowDrawingOutsideViewBox: true ); ``` I'm not specifying a width or height in flutter. There is a width and height in the SVG file (as in the earlier comment), but it is pretty much the bounding rectangle for the drawing. --- Comment by @dnfield on Nov 24, 2018 This feels like a bug to me. the alignment property isn't doing what it should be in this case. --- Comment by @dnfield on Nov 24, 2018 I've pushed up some new changes to master that should fix the alignment issues. I'm getting some more confidence in how this is working at this point, but would again like to hear some feedback from how this looks to you. I'm still not sure I'm getting the right level of fidelity on your original example (the `x` icon). --- Comment by @SteveAlexander on Nov 27, 2018 ok, so SVGs now appear centered correctly. There does seem to be quite a bit of padding around the graphics, which I can't account for in the SVG itself. The `x` icon is still a bit chunky. In Flutter: ![image](https://user-images.githubusercontent.com/4321921/49081999-6ddf9c80-f240-11e8-91ab-7b100db367df.png) In Chrome: ![image](https://user-images.githubusercontent.com/4321921/49082015-7b952200-f240-11e8-807d-f5cf42d352a4.png) ``` <?xml version="1.0" encoding="UTF-8"?> <svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 51.2 (57519) - http://www.bohemiancoding.com/sketch --> <title>Close</title> <desc>Created with Sketch.</desc> <defs></defs> <g id="03.-Agenda" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="square"> <g id="Filter" transform="translate(-338.000000, -22.000000)" stroke="#1A1A1A" stroke-width="4"> <g id="Close" transform="translate(347.000000, 31.000000) rotate(-45.000000) translate(-347.000000, -31.000000) translate(339.000000, 23.000000)"> <path d="M0,8 L16,8" id="Line-2"></path> <path d="M8,0 L8,16" id="Line-2"></path> </g> </g> </g> </svg> ``` --- Comment by @dnfield on Nov 27, 2018 Yes, I haven't quite been able to get that to look just right. Unfortunately I think you're probably beat off avoiding having width or height explicitly specified. :( --- Comment by @SteveAlexander on Nov 27, 2018 Naively, I'd think the viewBox would say what the default clipping rectangle and size of an svg shoudl be. --- Comment by @GoldenJoe on Dec 10, 2018 Haven't looked at the code, but I can guess the issue based on what I've seen in a few threads: device scale is being applied to the viewbox. The reason SVGs with dimension attributes look half size is because you're trying to draw on a canvas that is twice as large as it should be. Look at this: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox Now the spec you referenced above: > Unlike the ‘transform’ attribute (see effect of the ‘transform’ on sibling attributes), the automatic transformation that is created due to a ‘viewBox’ does not affect the ‘x’, ‘y’, ‘width’ and ‘height’ attributes (or in the case of the ‘marker’ element, the ‘markerWidth’ and ‘markerHeight’ attributes) on the element with the ‘viewBox’ attribute. Thus, in the example above which shows an ‘svg’ element which has attributes ‘width’, ‘height’ and ‘viewBox’, the ‘width’ and ‘height’ attributes represent values in the coordinate system that exists before the ‘viewBox’ transformation is applied. On the other hand, like the ‘transform’ attribute, it does establish a new coordinate system for all other attributes and for descendant elements. Think of the viewbox as a picture frame, the dimensions the size of a picture, and the elements as the actual content of the picture. Suppose you have dimensions of (h:100, w:100). If the contents are a simple circle `<circle cx="50%" cy="50%" r="50" fill="black"/>` then you have a circle that fills the 100x100 square working area. AFTER that, you apply the transformation of a ViewBox. `viewBox="0 0 100 100"` Would not change the way it is drawn. The circle would still have a center at (50,50) with a radius of 50. `viewBox="-50 0 100 100"` means _move the viewbox left 50 units_. It would be like moving the picture frame left. Inside the picture frame, you will see 50 units of blank space, then the circle which now has a global origin of (100, 50) but is otherwise the same. `viewBox="0 0 200 200"` would be like lifting the picture frame up to make the picture look half its size. The circle would now be drawn with an origin of (100,100) but a radius of 25. --- Comment by @dnfield on Dec 10, 2018 All the things you're discussing about the viewbox are supported - the only problem comes in when there is additional a width/height constraint. All of the scaling/transforming related to width/height happen after drawing. But when you have both a width/height and a viewBox, there are additional transforms that are supposed to take place that I suspect I'm still not getting 100% right - and I suspect even if I were to get right, would still be counter-intuitive in a Flutter related context. --- Comment by @GoldenJoe on Dec 10, 2018 There are only two ways to interpret this: 1. You render the elements in a canvas matching the view box first, then apply a scaling transformation the result to match the dimensions. 2. You render the elements in a canvas that matches the dimensions, then apply scaling/translation transformations according to the viewbox. If you think about it, it has to be number 2 because of how the Firefox examples work. But the bug we’re trying to fix is something else entirely. You’re taking dimensions (50,50) and a viewbox (0,0,50,50) and ending up with a render that has the icon squeezed into a 25x25 area in the center, with 12.5 units of padding. It’s not because of your ordering of dimension and viewbox transformations, it’s because of where you are applying a 2.0 scaling modifier when you compensate for the device’s resolution. It may be the viewbox, it may be dimensions. Unfortunately I can’t check the code where I am right now, but hopefully that explains my idea a bit better. --- Comment by @dnfield on Dec 11, 2018 What I'm doing is just drawing the elements to a canvas and then scaling it based on the viewbox. For Flutter, canvas doesn't have any pre-defined size. Either way I'm becoming more convinced that my current logic is incorrect for this issue and should be reverted. --- Comment by @dnfield on Dec 11, 2018 I'vereverted a bit related to this in e445889, which should resolve the other issue. Whatever is done for this, it has to be handled in some other way. --- Comment by @dnfield on Dec 17, 2018 I've reverted the changes I made to width/height processing - this still needs to be figured out though. --- Comment by @lazingor on Dec 26, 2019 My understanding is that the `width` and `height` attributes on an SVG element play quite a different role to the `viewBox` attribute, if the `viewBox` attribute is present. The `viewBox` determines the internal coordinates that all the other coordinates specified within the SVG element are relative to. By contrast, `width` and `height` then specify how big the drawing is meant to be in its **ambient placement**. So `<svg viewBox="0 0 1000 1000" width="50px" height="50px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="500" cy="500" r="100" /> </svg>` should render as an SVG of size 50px by 50px, with a circle centred in the middle of radius 1/10 of the width of the box. At the moment it seems to me that flutter_svg ignores the `width` and `height` attributes on the SVG element if the `viewBox` attribute is set. Is this intentional? One can then specify the height manually by setting the `height` property in the SvgPicture constructor. But is there a way to pick this up automatically from `height` attribute of the SVG? --- Comment by @KaMoKuMo on Jan 12, 2020 That is my understanding as well. Assuming the documents says: `<svg viewBox="0 0 vBx vBy" width=x height=y...>` You could 1. Draw the picture in a Box with width=vBx, height=vBy. 2. Scale the width by a factor of x/vBx and the height by a factor of y/vBy --- Comment by @AhmedLSayed9 on Jan 22, 2024 The issue has been around for a long time 😭
package,p: flutter_svg
low
Critical
2,655,882,262
flutter
[flutter_svg] File manipulation (tinting one group in the SVG)
_Imported from https://github.com/dnfield/flutter_svg/issues/79_ Original report by @ChristianKleineidam on Nov 11, 2018 The use case lists says: "Your vector drawing is meant to be static and non (or maybe minimally) interactive." I have an `svg` with multiple groups (`<g>` elements) and want to be able to tint one of those at runtime either red or green. Is this currently possible with this library? If it isn't is such functionality out of scope or might it be developed in the future (or eventually pull requests for it accepted)? --- Comment by @dnfield on Nov 11, 2018 This is not currently supported. I'd be open to options around this, but wouldn't want to compromise performance or memory usage for it. --- Comment by @cornwe19 on Dec 19, 2018 @ChristianKleineidam This is technically possible if you drop down a level and use a `CustomPainter` to draw the layers of the SVG individually. Check out `Drawable.draw(Canvas, ColorFilter)` @dnfield that said, it would be really helpful to cache IDs provided for each `Drawable` in the drawable itself. The current system of only being able to look them up inside a `DrawableRoot`'s definitions makes it hard to enumerate the IDs of layers present in an SVG. Would you be open to a PR to expose IDs on `Drawable`s? --- Comment by @dnfield on Dec 19, 2018 Yes, that sounds entirely reasonable to me. Something like a `final String id`? And we could presumably implement `hashCode` and `operator ==` via that? --- Comment by @cornwe19 on Dec 19, 2018 Yeah, that would be ideal. For elements with no `id` defined we could fall back on the default instance equality the Drawables currently use. --- Comment by @yuridiniz on Apr 9, 2019 I have the same need, the only option I found is with `mergeStyle`, but it does not work very well when you have several `<g>` in your svg. Are you planning to change the style by `id`?
package,p: flutter_svg
low
Major
2,655,882,376
flutter
[flutter_svg] 'fitWidth' does not set the widget height properly
_Imported from https://github.com/dnfield/flutter_svg/issues/83_ Original report by @abeintopalo on Nov 14, 2018 When using `BoxFit.fitWidth` with SvgPicture results that the content is scaled up properly according to the container widget's width but the actual SvgPicture dimensions are not correct resulting in cropped image. Sample code: ``` Widget build(BuildContext context) { return Scaffold( body: Row( children: <Widget>[ Spacer( flex: 1, ), Expanded( flex: 8, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Spacer( flex: 2, ), Expanded( flex: 8, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ SvgPicture.asset( 'assets/circles.svg', color: Colors.black, fit: BoxFit.fitWidth, ), Image.asset( 'assets/circles.png', fit: BoxFit.fitWidth ), ], ), ), ], ), ), Spacer( flex: 1, ) ], ), ); } } ``` <img width="530" alt="iphone x" src="https://user-images.githubusercontent.com/7497004/48469734-4f1ce700-e7f8-11e8-9cda-2de13fab56ea.png"> In the sample code above `circles.svg` and 'circles.png` have "identical" content. I would expect that SvgPicture widget scales the same way as Image widget i.e. without cropping. --- Comment by @dnfield on Nov 14, 2018 Can you share the svg? --- Comment by @abeintopalo on Nov 14, 2018 Sure. ``` <?xml version="1.0" encoding="UTF-8"?> <svg width="332px" height="58px" viewBox="0 0 332 58" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 52.4 (67378) - http://www.bohemiancoding.com/sketch --> <title>Slice 1</title> <desc>Created with Sketch.</desc> <g id="Page-2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <circle id="Circle-6" stroke="#979797" fill="#000000" cx="303.5" cy="28.5" r="27.5"></circle> <circle id="Circle-5" stroke="#979797" fill="#000000" cx="248.5" cy="28.5" r="27.5"></circle> <circle id="Circle-4" stroke="#979797" fill="#000000" cx="193.5" cy="28.5" r="27.5"></circle> <circle id="Circle-3" stroke="#979797" fill="#000000" cx="138.5" cy="28.5" r="27.5"></circle> <circle id="Circle-2" stroke="#979797" fill="#000000" cx="83.5" cy="28.5" r="27.5"></circle> <circle id="Circle-1" stroke="#979797" fill="#000000" cx="28.5" cy="29.5" r="27.5"></circle> </g> </svg> ``` --- Comment by @dnfield on Nov 24, 2018 Are you on master or on the published version? --- Comment by @abeintopalo on Nov 26, 2018 I have this in my `pubspec.yaml`: `flutter_svg: ^0.6.3`
package,p: flutter_svg
low
Minor
2,655,882,487
flutter
[flutter_svg] SvgPicture.network() don't shows the image but no errors getted
_Imported from https://github.com/dnfield/flutter_svg/issues/103_ Original report by @quetool on Jan 17, 2019 Like the title says, SvgPicture.network('https://staging.apperto.co/rocketchat/avatar/mhuergo') doesn't shows up no matter where I put the widget --- Comment by @dnfield on Jan 17, 2019 I'm not sure why you're not getting errors, but it looks like percentages don't work for width and height parameters on a rect right now. I get a stack dump like this: ``` flutter: ══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════ flutter: The following FormatException was thrown resolving a single-frame picture stream: flutter: Invalid double flutter: 100% flutter: flutter: When the exception was thrown, this was the stack: flutter: #0 double.parse (dart:core/runtime/libdouble_patch.dart:110:28) flutter: #1 _Paths.rect (package:flutter_svg/src/svg/parser_state.dart:506:29) flutter: #2 SvgParserState.addShape (package:flutter_svg/src/svg/parser_state.dart:664:31) flutter: #3 SvgParserState.startElement (package:flutter_svg/src/svg/parser_state.dart:689:12) flutter: #4 SvgParserState.parse (package:flutter_svg/src/svg/parser_state.dart:590:15) flutter: <asynchronous suspension> ... ``` This should be supportable but I'm not sure it's a trivial fix. I'd be happy to take a PR for it. --- Comment by @dnfield on Jan 17, 2019 (Are you sure your testing device/emulator is connected to the network?) --- Comment by @quetool on Jan 17, 2019 I will look into it! > (Are you sure your testing device/emulator is connected to the network?) Yes, off course :) --- Comment by @mintermania on Jun 10, 2019 I got the same problem, all svg images work fine, except of those: https://btcsecure.io/img/logo.svg https://minter.stakeholder.space/local/templates/minter_pool/images/logo.svg https://minter.center/images/MC_logo_svg.svg --- Comment by @bailyzheng on Jun 29, 2019 I found that it will report "Invalid double" when it contains ```<rect width="100%" height="100%" fill="#ffffff"/>``` --- Comment by @hirenvadher954 on Aug 27, 2019 Can anyone able to solve it some SVG images won't able to render and throw an error like "The following FormatException was thrown resolving a single-frame picture stream". --- Comment by @hirenvadher954 on Aug 27, 2019 > I'm not sure why you're not getting errors, but it looks like percentages don't work for width and height parameters on a rect right now. > > I get a stack dump like this: > > ``` > flutter: ══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════ > flutter: The following FormatException was thrown resolving a single-frame picture stream: > flutter: Invalid double > flutter: 100% > flutter: > flutter: When the exception was thrown, this was the stack: > flutter: #0 double.parse (dart:core/runtime/libdouble_patch.dart:110:28) > flutter: #1 _Paths.rect (package:flutter_svg/src/svg/parser_state.dart:506:29) > flutter: #2 SvgParserState.addShape (package:flutter_svg/src/svg/parser_state.dart:664:31) > flutter: #3 SvgParserState.startElement (package:flutter_svg/src/svg/parser_state.dart:689:12) > flutter: #4 SvgParserState.parse (package:flutter_svg/src/svg/parser_state.dart:590:15) > flutter: <asynchronous suspension> > ... > ``` > > This should be supportable but I'm not sure it's a trivial fix. I'd be happy to take a PR for it. The same error occurred to me now tell us how to solve it if possible? --- Comment by @dnfield on Aug 27, 2019 Your SVG is using a `%` where it's not currently supported. If you have the SVG in question we could look at it and see about making it work. --- Comment by @hirenvadher954 on Aug 28, 2019 > Your SVG is using a `%` where it's not currently supported. If you have the SVG in question we could look at it and see about making it work. https://restcountries.eu/data/asm.svg --- Comment by @sonikslayer on May 6, 2020 > > Your SVG is using a `%` where it's not currently supported. If you have the SVG in question we could look at it and see about making it work. > > https://restcountries.eu/data/asm.svg Was there ever a fix to this? --- Comment by @zhangao0086 on Jun 11, 2020 +1 --- Comment by @denizdogan on Sep 5, 2020 Having the exact same problem, also with a flag: https://restcountries.eu/data/bra.svg --- Comment by @bydev777 on Jan 2, 2021 Find in your SVG file and remove this : width="100%" height="100%" will help --- Comment by @martin-jorgensen on Jun 3, 2021 Still doesn't work: [https://restcountries.eu/data/asm.svg](https://restcountries.eu/data/asm.svg) Invalid double 1pt When using SvgPicture.network(), the SVG is online, and changing it on the fly hardly seems like the right solution (though it might be necessary, until a real solution is in place ) --- Comment by @Prasan02 on Sep 1, 2021 I am facing the same issue, do we have any solution yet? --- Comment by @osmanGuler19 on Oct 28, 2021 Faced the same issiue --- Comment by @hitripod on Nov 10, 2021 same here: https://storage.opensea.io/files/2608580f4b0251e8945e6e20e4c541dc.svg --- Comment by @JagaranMaharjan on Dec 31, 2021 I am facing the same issue, do we have any solution? --- Comment by @pansitwattana on Feb 7, 2022 Hello I also got this error. any update for this ? --- Comment by @sebapastore on Mar 11, 2022 I have the same issue, caused by: ''stroke-width="1pt". If I remove de "pt" from the vector file, it works. --- Comment by @ on May 5, 2022 Did anyone solve the problem? I have the following error: The following XmlParserException was thrown resolving a single-frame picture stream: <!DOCTYPE expected at 208:5 --- Comment by @joseph-lewis on Sep 21, 2023 I'm still getting this at the end of 2023... Is there a fix? Getting it from one or both of these SVG's only sometimes... Svg1: ``` <svg enable-background="new 0 0 1024 1024" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"> <path d="m932.19 421.19c0-232.07-188.13-420.19-420.19-420.19s-420.19 188.12-420.19 420.19c0 115.56 45.69 219.25 121.19 295.21l292.04 298.49c12.51 11.23 31.61 10.74 43.53-1.12l263.18-298.14c75.5-75.96 120.44-178.88 120.44-294.44z" fill="#000000"/> <path d="m617.25 639.54h6.51 17.62 8.69c8.64 0 17.68-3.31 17.68-16.51v-4.59c0-.02.06-.08.06-.11v-8.91c0-3.19 2.4-5.68 5.54-6.22 27.99-4.84 49.5-32.08 49.5-64.83v-183.85h16.02c7.47 0 13.53-6.06 13.53-13.53v-64.97c0-5.63-3.44-10.44-8.34-12.48l-21.21-8.99v-6.47c0-30.21-18.34-55.5-43.12-63.09-.32-.13-.53-.29-.95-.4-.13-.03-.31-.08-.44-.12-.64-.18-1.26-.36-1.91-.51-15.34-4.16-56.91-15.93-152.14-17.4-.09 0-.19 0-.28-.01-2.58-.04-5.18-.07-7.84-.1-1.62-.02-3.26-.06-4.88-.06-.94 0-1.89.03-2.83.03-3.43-.01-6.72-.05-10.28-.03-111.68.52-155.31 17.89-163.24 21.53-.18.09-.37.16-.55.26-.55.26-.93.45-.93.45l.07.09c-19.91 10.47-33.79 33.08-33.79 59.35v118.88h-14.61c-7.47 0-13.53 6.06-13.53 13.53v64.97c0 5.7 3.55 10.53 8.53 12.52l19.61 8.31v72.07c0 32.44 21.09 59.46 48.68 64.68 3.1.59 5.44 3.06 5.44 6.21v13.77c0 13.2 9.04 16.51 17.68 16.51h32.82c10.81 0 16.84-5.64 16.84-16.03v-13.17c0-3.53 2.86-6.39 6.39-6.39h162.46 3.97c3.53 0 6.39 2.86 6.39 6.39v13.17c0 10.42 6.03 16.05 16.84 16.05zm79.75-121.4c-15.47 15.74-82.4 18.4-89.94 6.76-7.54-11.65 5.47-29.77 22.53-41.85 18.03-12.75 53.8-31.65 67.41-20.86 10.17 8.08 9.22 46.56 0 55.95zm-273.19 6.76c-7.54 11.64-74.47 8.98-89.94-6.76-9.22-9.39-10.17-47.88 0-55.95 13.61-10.79 49.38 8.11 67.41 20.86 17.06 12.08 30.07 30.2 22.53 41.85zm151.07 51.58h-120.03c-7.19 0-13.02-5.83-13.02-13.02s5.83-13.02 13.02-13.02h120.03c7.19 0 13.02 5.83 13.02 13.02s-5.83 13.02-13.02 13.02zm-63.32-130.11c-63.94 0-124.32-15.53-172.37-44.03-6.71-3.98-10.63-11.41-10.63-19.22v-134.7c0-18.71 366-18.71 366 0v134.74c0 7.79-3.91 15.19-10.6 19.17-48.06 28.51-108.45 44.04-172.4 44.04z" fill="#fff"/> </svg> ``` ``` Svg2: <?xml version="1.0" encoding="utf-8"?> <svg width="1024" height="1024" enable-background="new 0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"> <g transform="matrix(1, 0, 0, 1, 5.359098, -4.335575)"> <title>Layer 1</title> <path id="svg_1" fill="#000000" d="m932.19,421.19c0,-232.07 -188.13,-420.19 -420.19,-420.19s-420.19,188.12 -420.19,420.19c0,115.56 45.69,219.25 121.19,295.21l292.04,298.49c12.51,11.23 31.61,10.74 43.53,-1.12l263.18,-298.14c75.5,-75.96 120.44,-178.88 120.44,-294.44z"/> <text transform="matrix(23.885 0 0 24.3478 -7916.98 -9373.89)" stroke="null" text-anchor="start" font-family="Arial, sans-serif" font-size="10" stroke-width="0" id="svg_3" y="406.90386" x="338.97323" fill="#FFFFFF" style="white-space: pre;">Text</text> </g> </svg> ```
package,p: flutter_svg
low
Critical
2,655,882,653
flutter
[flutter_svg] The <style> element is not implemented in this library
_Imported from https://github.com/dnfield/flutter_svg/issues/105_ Original report by @ScrivNetwork on Jan 24, 2019 Need implement <style> --- Comment by @dnfield on Jan 24, 2019 I don't plan to do this, largely because it would require implementing the entire CSS spec to do so, and becuase the cascading rules would become even more complicated. There are tools that can help with this, such as https://github.com/RazrFalcon/resvg/tree/master/usvg All of that said, I'd entertain a patch for it if someone else wants to work on it. --- Comment by @unschool on Apr 4, 2019 This tool worked in my case, https://github.com/RazrFalcon/svgcleaner --- Comment by @kaige-cai on Nov 22, 2019 No, Just modify the fill of attr to label like \<svg>\<path fill="#fff" xxx="0000"/>\</svg> --- Comment by @sahiljangra on Dec 28, 2019 If you are using CorelDRAW to Create SVG Image then Use these configuration: **CorelDRAW Configuration** **Compatibility** : SVG1.0/1.1 **Encoding Method** : Unicode - UTF-8 **Styling Option** : Presentation Attributors **Bitmap Export Type** : Embeded ![corelDraw capture](https://user-images.githubusercontent.com/34799233/71539342-00310300-2961-11ea-817c-fd170787dcf4.JPG) And for **Adobe Illustrator** **Styling** : Presentation Attributors ![illustrator capture](https://user-images.githubusercontent.com/34799233/71539344-07f0a780-2961-11ea-95c9-755a84aa7087.JPG) --- Comment by @piuskamil on Apr 20, 2020 this tool works for me https://jakearchibald.github.io/svgomg/ --- Comment by @masfranzhuo on May 11, 2020 > > > This tool worked in my case, https://github.com/RazrFalcon/svgcleaner thanks, it works on my case --- Comment by @ShadyBoshra2012 on May 24, 2020 > > > This tool worked in my case, https://github.com/RazrFalcon/svgcleaner Thanks, that worked for me too. --- Comment by @aawizard on May 28, 2020 Thanks :) > this tool works for me https://jakearchibald.github.io/svgomg/ --- Comment by @thealiflab on Jul 6, 2020 You can watch this answer from StackOverflow https://stackoverflow.com/a/62748066/11681472 --- Comment by @yourshinsuke on Aug 20, 2020 @piuskamil Did you use default settings and pushed `[RESET ALL]` button? --- Comment by @piuskamil on Aug 20, 2020 @yourshinsuke yes i used default setting. --- Comment by @erickfiori on Aug 22, 2020 > This tool worked in my case, https://github.com/RazrFalcon/svgcleaner It worked! Thank You! --- Comment by @msgtobala on Dec 4, 2020 > > This tool worked in my case, https://github.com/RazrFalcon/svgcleaner > > It worked! > Thank You! ?? what we have to do? --- Comment by @cdmunoz on Dec 26, 2020 Even using an external tool such as [Jake Archibald's](https://jakearchibald.github.io/svgomg/), if the svg is using a `<style>` it will fail. Usually style is written as follows: ```<style>.st0{fill:#f47521}</style>``` Then it's references from a `path`: ```<path class="st0" ...... />``` For this cases, you can just remove the style tag, the class within path and replace the latter fro a fill attribute with the proper color, and that is all: ```<path fill="#f47521" ...... />``` --- Comment by @kadnan0900 on Dec 29, 2020 > > This tool worked in my case, https://github.com/RazrFalcon/svgcleaner > > It worked! > Thank You! Can you please explain how you solved this issue ? --- Comment by @hadasacwebit on Dec 29, 2020 > > > This tool worked in my case, https://github.com/RazrFalcon/svgcleaner > > > > > > It worked! > > Thank You! > > Can you please explain how you solved this issue ? Download and install the application to your computer. and then.. <img width="539" alt="Screen Shot 2020-12-29 at 18 30 40" src="https://user-images.githubusercontent.com/34736340/103298891-f7578f00-4a03-11eb-9d2e-05d5935fe016.png"> --- Comment by @Saransh-cpp on Feb 11, 2021 > Even using an external tool such as [Jake Archibald's](https://jakearchibald.github.io/svgomg/), if the svg is using a `<style>` it will fail. Usually style is written as follows: > > `<style>.st0{fill:#f47521}</style>` > > Then it's references from a `path`: > > `<path class="st0" ...... />` > > For this cases, you can just remove the style tag, the class within path and replace the latter fro a fill attribute with the proper color, and that is all: > > `<path fill="#f47521" ...... />` Good day Sir, can you please guid me as to how to fix my SVG's style? The SVG is as mentioned below: ``` <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100.32 98.2"> <defs> <style>.cls-1,.cls-2{fill:none;stroke:#1f9fff;stroke-miterlimit:10;stroke-width:11px;}.cls-2{stroke-linecap:round;}</style> </defs> <title>doclenselightsmall</title> <polyline class="cls-1" points="66.7 5.5 94.83 5.5 94.83 31.18"/> <polyline class="cls-1" points="33.63 92.7 5.5 92.7 5.5 67.02"/> <polyline class="cls-1" points="66.7 92.7 94.83 92.7 94.83 67.02"/> <polyline class="cls-1" points="33.63 5.5 5.5 5.5 5.5 31.18"/> <line class="cls-2" x1="22.37" y1="26.75" x2="78.32" y2="26.75"/> <line class="cls-2" x1="22.37" y1="48.72" x2="78.32" y2="48.72"/> <line class="cls-2" x1="22.37" y1="70.7" x2="78.32" y2="70.7"/> </svg> ``` --- Comment by @dnfield on Feb 11, 2021 The easiest way is to have your design tool not use CSS if possible. Alternatively, using [`svgcleaner`](https://github.com/razrfalcon/svgcleaner) works on this, and produces: ``` <svg viewBox="0 0 100.32 98.2" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#1f9fff" stroke-miterlimit="10" stroke-width="11"><path d="m66.7 5.5h28.13v25.68"/><path d="m33.63 92.7h-28.13v-25.68"/><path d="m66.7 92.7h28.13v-25.68"/><path d="m33.63 5.5h-28.13v25.68"/><g stroke-linecap="round"><path d="m22.37 26.75h55.95"/><path d="m22.37 48.72h55.95"/><path d="m22.37 70.7h55.95"/></g></g></svg> ``` --- Comment by @Saransh-cpp on Feb 12, 2021 > The easiest way is to have your design tool not use CSS if possible. > > Alternatively, using [`svgcleaner`](https://github.com/razrfalcon/svgcleaner) works on this, and produces: > > ``` > <svg viewBox="0 0 100.32 98.2" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#1f9fff" stroke-miterlimit="10" stroke-width="11"><path d="m66.7 5.5h28.13v25.68"/><path d="m33.63 92.7h-28.13v-25.68"/><path d="m66.7 92.7h28.13v-25.68"/><path d="m33.63 5.5h-28.13v25.68"/><g stroke-linecap="round"><path d="m22.37 26.75h55.95"/><path d="m22.37 48.72h55.95"/><path d="m22.37 70.7h55.95"/></g></g></svg> > ``` Okay! Thank you so much for the conversion and the tip:)! --- Comment by @fricred on May 9, 2021 well, now the problem is, network load, like "https://devdc.mycollab.co/jira/secure/projectavatar?avatarId=10324" for users, projects etc.... (dynamic) (jira server implementation), we. have no control of this svg images, so?? any ideas? --- Comment by @JanDrabik on May 14, 2021 @fricred Having exactly same issue; network load seems impossible to fix on the run, Im also looking for solution to this problem. --- Comment by @fricred on May 14, 2021 > @fricred > Having exactly same issue; network load seems impossible to fix on the run, Im also looking for solution to this problem. had to download and clean the svg and make a component to check is in assets folder or try network load :( , like 50 avatars *sigh* --- Comment by @Mr-Akki-Jangir on May 16, 2021 > If you are using CorelDRAW to Create SVG Image > then Use these configuration: > > **CorelDRAW Configuration** > **Compatibility** : SVG1.0/1.1 > **Encoding Method** : Unicode - UTF-8 > **Styling Option** : Presentation Attributors > **Bitmap Export Type** : Embeded > ![corelDraw capture](https://user-images.githubusercontent.com/34799233/71539342-00310300-2961-11ea-817c-fd170787dcf4.JPG) > > And for **Adobe Illustrator** > **Styling** : Presentation Attributors > ![illustrator capture](https://user-images.githubusercontent.com/34799233/71539344-07f0a780-2961-11ea-95c9-755a84aa7087.JPG) The illustrator Configuration works for me --- Comment by @agnamc9 on Jun 15, 2021 This works for me ! https://github.com/dnfield/flutter_svg/issues/105#issuecomment-479724077 Thanks @unschool --- Comment by @SawWebFuture on Jul 12, 2021 You can just go into the svg file and remove the <style> tag. Worked for me: //remove this and save <style type="text/css"> .st0{fill:#3A3A3A;} </style> --- Comment by @alarkirikal on Oct 14, 2021 How have peopl handled this with `SvgPicture.network(...)` cases? --- Comment by @edex96 on Jan 4, 2022 @alarkirikal If your svg links are externally sourced and no way to edit them you can edit the parser to skip the <style> tag. ```dart if (event.name == 'style') { _discardSubtree(); continue; } ``` **path:** _%userprofile%\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_svg-1.0.0\lib\src\svg\parser_state.dart_ **line:** _940_ ```dart /// Drive the [XmlTextReader] to EOF and produce a [DrawableRoot]. Future<DrawableRoot> parse() async { for (XmlEvent event in _readSubtree()) { if (event is XmlStartElementEvent) { if (event.name == 'style') { _discardSubtree(); continue; } if (startElement(event)) { continue; } final _ParseFunc? parseFunc = _svgElementParsers[event.name]; await parseFunc?.call(this, _warningsAsErrors); if (parseFunc == null) { if (!event.isSelfClosing) { _discardSubtree(); } assert(() { unhandledElement(event); return true; }()); } } else if (event is XmlEndElementEvent) { if (event.name == 'style') { continue; } endElement(event); } } if (_root == null) { throw StateError('Invalid SVG data'); } return _root!; } ``` or better yet :D ```dart return FutureBuilder( future: get(Uri.parse(url)), builder: (context, AsyncSnapshot snap) { if (snap.hasData) { final svgStr = utf8.decode(snap.data.bodyBytes); final parser = SvgParser(); try { parser.parse(svgStr, warningsAsErrors: true); return SvgPicture.string(svgStr); } catch (e) { print(e); return const Icon(Icons.info); } } return const SizedBox.shrink(); }, ); ``` --- Comment by @TjayAmit on Jan 16, 2022 I encounter this problem and I tried to look for possible solusyon, I found this link https://blog.logrocket.com/implement-svg-flutter-apps/ I found here that the problem because the package flutter_sgv is not supporting attribute <style> that is mostly use in css, so I tried to open my svg file and delete the attribute <style> and the exception has gone. It may also cause a downside of deleting it directly but I still don't know if it really cause a problem. but it works for me. --- Comment by @abegehr on Feb 19, 2022 > this tool works for me https://jakearchibald.github.io/svgomg/ Or check out the command line tool here: https://github.com/svg/svgo – works like a charm! --- Comment by @Mahani9271 on May 10, 2022 Hi every body , we solved this problem, check this url https://pub.dev/packages/flutter_svg_with_style_tag --- Comment by @mikealfandre on May 31, 2022 You need to remove the style tag if you will be changing the style dynamically like fill for example --- Comment by @Illangovan2022 on Jun 7, 2022 > Do we need to consider the units, while exporting SVG's from Coreldraw and Adobe Illustrator? If yes, please guide how to proceed further. (ex. pixels, mm, cm, inches etc.,) --- Comment by @Malomalote on Aug 30, 2022 There are a not elegant solution: You can parse svg string before render. I explain: add the following function and auxiliary class: ```dart // ignore_for_file: public_member_api_docs, always_specify_types ///replace style element in svg String String replaceStyleElement(String input) { String transformsvg = input; if (input.contains('<style')) { final int posInit = input.indexOf('<style'); final int posEnd = input.indexOf('</style>'); final String styleString = input .substring(posInit, posEnd + '</style>'.length) .replaceAllMapped(RegExp('<style.*'), (Match match) => '') .replaceAll('</style>', ''); final List<String> stylesRaw = styleString.split('.'); final List<Pair<String, String>> styles = []; for (String l in stylesRaw) { final String first = l.split('{').first; final String second = l.split('{').last.split('}').first; styles.add(Pair(first, second)); } for (Pair<String, String> j in styles) { transformsvg = transformsvg.replaceAll('class="${j.first}"', 'style="${j.second}"'); } } return transformsvg; } //from https://stackoverflow.com/questions/64282563/list-of-tuples-in-flutter-dart ///Simple aux Class Pair class Pair<T1, T2> { Pair(this.first, this.second); final T1 first; final T2 second; @override String toString() => 'Pair(a: $first, b: $second)'; } ``` Then modify the parser.dart file as follow: line 27. ```dart SvgParserState(xml.parseEvents(replaceStyleElement(str)), theme, key, warningsAsErrors); ``` I tried several files and works for my. Additionally I code a simple app in flutter that allows save the file without the style element: repository: [https://github.com/Malomalote/svg-replace-style-element](url) --- Comment by @Malomalote on Aug 30, 2022 I'm sorry the link don't work. Here the correct link. https://github.com/Malomalote/svg-replace-style-element --- Comment by @PureTryOut on Oct 6, 2022 Sadly in my case I have no control over the vector images I'm loading and can thus not rely on removing the `<style>` tag in advance. This library works and loads the images just fine, they even look fine, but it spits out this warning per image loaded. I can understand making an entire CSS parser is too much, but can not existing packages like https://pub.dev/packages/csslib be used to accomplish it instead? If only Flutter had built-in SVG support instead :cry: --- Comment by @Sergio55Veliz on Dec 29, 2022 Just have to export your designs like in the image. The documentation has this section [documentation](https://pub.dev/packages/flutter_svg#recommended-adobe-illustrator-svg-configuration) that tells you how to export your design, but the SVG Options windows wasn't the same for me. ![image](https://user-images.githubusercontent.com/58049244/210008066-1187a921-cf4b-41e4-ac14-fce27ef3ac93.png) --- Comment by @Toothgip on Feb 16, 2023 > How have peopl handled this with `SvgPicture.network(...)` cases? I found [this library](https://pub.dev/packages/jovial_svg) for handle network SVG
package,p: flutter_svg
low
Critical
2,655,882,788
flutter
[flutter_svg] flutter_svg throws an xml dependency runtime error
_Imported from https://github.com/dnfield/flutter_svg/issues/106_ Original report by @minimih on Jan 25, 2019 I encountered a runtime error after a did a clean build (`flutter clean`). The XML dependency has some breaking changes in v3.3.0 with v3.2.5 it's working. As a workaround i defined the xml dependency in my project pubspec.yaml manually (`xml: 3.2.5`) Possible solution is to change the flutter_svg pubspec.yaml to use `xml: 3.2.5` instead of `xml: ^3.2.5` --- Comment by @dnfield on Jan 25, 2019 I can do that. I thought the caret would have not applied to that kind of bump though :( --- Comment by @minimih on Jan 25, 2019 in node.js the carret matches any `3.x.x` releases. The tilde matches any 3.2.x releases. But i don't know if flutter/dart implements it the same. --- Comment by @dnfield on Jan 25, 2019 Fixed in 0.10.3 I'll be updating this to use the new API in the XML package at some point.
package,p: flutter_svg
low
Critical
2,655,882,916
flutter
[flutter_svg] width and height properties not working as %
_Imported from https://github.com/dnfield/flutter_svg/issues/110_ Original report by @grfxjedi on Feb 1, 2019 I'm using svgs generated by MathJax (http://docs.mathjax.org/en/latest/index.html). These files have a very large viewBox and height and width represented in % to scale down. The files render fine in browser. I'm loading the files with SvgPicture.network. In the console I get this output: `flutter: Warning: Flutter SVG only supports the following formats for `width` and `height` on the SVG root:` ` width="100%"` ` width="100px"` ` width="100" (where the number will be treated as pixels).` `The supplied value (22.407%) will be discarded and treated as if it had not been specified.` ` flutter: Warning: Flutter SVG only supports the following formats for `width` and `height` on the SVG root:` ` width="100%" ` width="100px" ` width="100" (where the number will be treated as pixels).` `The supplied value (5.009%) will be discarded and treated as if it had not been specified.` It looks to me like the % values are being ignored and treated as pixels. This is throwing the size of the images way off. They are huge and I have to scale them down. The problem with this is that I'm displaying several images at once that are not the same size, so they scale differently to fill the boxes, making some of them zoomed in more than others. Please let me know if this is a bug in the plugin or if I should be doing something differently. This is my dart code: `child: SvgPicture.network(` ` '$svgUrl$equation', // dynamically generated url` ` height: 50,` ` color: Colors.indigo,` ` alignment: Alignment.topLeft,` ` fit: BoxFit.contain,` `),` This is a sample svg file: `<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="22.407%" height="5.009%" style="vertical-align:-1.705%" viewBox="0 -1422.8 9647.3 2156.8" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg"> <g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"> <path stroke-width="1" d="M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z"></path> <path stroke-width="1" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z" transform="translate(500,0)"></path> <path stroke-width="1" d="M352 287Q304 211 232 211Q154 211 104 270T44 396Q42 412 42 436V444Q42 537 111 606Q171 666 243 666Q245 666 249 666T257 665H261Q273 665 286 663T323 651T370 619T413 560Q456 472 456 334Q456 194 396 97Q361 41 312 10T208 -22Q147 -22 108 7T68 93T121 149Q143 149 158 135T173 96Q173 78 164 65T148 49T135 44L131 43Q131 41 138 37T164 27T206 22H212Q272 22 313 86Q352 142 352 280V287ZM244 248Q292 248 321 297T351 430Q351 508 343 542Q341 552 337 562T323 588T293 615T246 625Q208 625 181 598Q160 576 154 546T147 441Q147 358 152 329T172 282Q197 248 244 248Z" transform="translate(779,0)"></path> <g transform="translate(1501,0)"> <path stroke-width="1" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path> </g> <g transform="translate(2280,0)"> <g transform="translate(342,0)"> <rect stroke="none" width="1900" height="60" x="0" y="220"></rect> <g transform="translate(60,676)"> <path stroke-width="1" d="M164 157Q164 133 148 117T109 101H102Q148 22 224 22Q294 22 326 82Q345 115 345 210Q345 313 318 349Q292 382 260 382H254Q176 382 136 314Q132 307 129 306T114 304Q97 304 95 310Q93 314 93 485V614Q93 664 98 664Q100 666 102 666Q103 666 123 658T178 642T253 634Q324 634 389 662Q397 666 402 666Q410 666 410 648V635Q328 538 205 538Q174 538 149 544L139 546V374Q158 388 169 396T205 412T256 420Q337 420 393 355T449 201Q449 109 385 44T229 -22Q148 -22 99 32T50 154Q50 178 61 192T84 210T107 214Q132 214 148 197T164 157Z"></path> <path stroke-width="1" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z" transform="translate(500,0)"></path> <path stroke-width="1" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z" transform="translate(779,0)"></path> <path stroke-width="1" d="M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z" transform="translate(1279,0)"></path> </g> <g transform="translate(310,-686)"> <path stroke-width="1" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path> <path stroke-width="1" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z" transform="translate(500,0)"></path> <path stroke-width="1" d="M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z" transform="translate(779,0)"></path> </g> </g> </g> <g transform="translate(4864,0)"> <path stroke-width="1" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path> </g> <g transform="translate(5865,0)"> <path stroke-width="1" d="M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z"></path> <path stroke-width="1" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z" transform="translate(500,0)"></path> <path stroke-width="1" d="M164 157Q164 133 148 117T109 101H102Q148 22 224 22Q294 22 326 82Q345 115 345 210Q345 313 318 349Q292 382 260 382H254Q176 382 136 314Q132 307 129 306T114 304Q97 304 95 310Q93 314 93 485V614Q93 664 98 664Q100 666 102 666Q103 666 123 658T178 642T253 634Q324 634 389 662Q397 666 402 666Q410 666 410 648V635Q328 538 205 538Q174 538 149 544L139 546V374Q158 388 169 396T205 412T256 420Q337 420 393 355T449 201Q449 109 385 44T229 -22Q148 -22 99 32T50 154Q50 178 61 192T84 210T107 214Q132 214 148 197T164 157Z" transform="translate(779,0)"></path> </g> <g transform="translate(7367,0)"> <path stroke-width="1" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path> </g> <g transform="translate(8367,0)"> <path stroke-width="1" d="M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z"></path> <path stroke-width="1" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z" transform="translate(500,0)"></path> <path stroke-width="1" d="M42 313Q42 476 123 571T303 666Q372 666 402 630T432 550Q432 525 418 510T379 495Q356 495 341 509T326 548Q326 592 373 601Q351 623 311 626Q240 626 194 566Q147 500 147 364L148 360Q153 366 156 373Q197 433 263 433H267Q313 433 348 414Q372 400 396 374T435 317Q456 268 456 210V192Q456 169 451 149Q440 90 387 34T253 -22Q225 -22 199 -14T143 16T92 75T56 172T42 313ZM257 397Q227 397 205 380T171 335T154 278T148 216Q148 133 160 97T198 39Q222 21 251 21Q302 21 329 59Q342 77 347 104T352 209Q352 289 347 316T329 361Q302 397 257 397Z" transform="translate(779,0)"></path> </g> </g> </svg>` --- Comment by @dnfield on Feb 1, 2019 This is a bug, but I'm not entirely sure about the best way to fix it. The error text is misleading. Percentages are not supported in a bunch of places - the support is inconsistent. I could try to make it more consistent, but on the root object itself I'm not sure how to make sense of that. Do you expect your drawing to be a percentage of the available screen? The SvgPicture widget? somethign else? --- Comment by @grfxjedi on Feb 5, 2019 I would expect the percentages to be relative to the available space. Like in a web browser, if you just open an svg file with %, it will be based on the browser window. If you have the image constrained inside a div, the percentage is based on the size of that div. So an example in flutter, say you have a container widget is 200px wide and the svgs width is set to 50%, I would expect the svg to render at a width of 100px. Or if you had two columns with flex widths 1 and 2, then you put that same svg (width 100%) in each, that the svgs would scale similarly filling half the space of each column. --- Comment by @tkez on Apr 23, 2019 Hi Dan, svg with defined width and height, but having rect with width and height in percentage would throw exception. Any suggestion to get the parentNode attribute so that it can calculate the percentage based on that? sample: <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"150\" height=\"50\">**<rect width=\"100%\" height=\"100%\" fill=\"#f5f7fa\"/>**<path fill=\"#e584b5\" d=\"M27.38 12.75L26.93 13.45L25.60 13.49L25.49 13.38Q25.10 13.66 24.69 13.49L24.56 13.36L19.47 13.94L18.95 14.78L18.87 14.70Q19.37 17.42 26.25 17.31L26.20 17.27L26.27 17.33Q24.41 20.13 22.19 21.21L22.14 21.16L22.11 23.63L23.40 24.45L23.55 24.59Q26.42 23.09 29.37 23.37L29.48 23.49L29.48 24.38L29.46 24.36Q30.68 25.03 29.43 27.98L29.48 28.03L28.22 28.14L28.21 28.13Q25.99 31.71 22.07 31.99L22.17 32.10L22.19 32.11Q20.85 33.04 19.19 32.97L19.10 32.88L19.22 33.01Q18.37 33.91 18.44 35.16L18.57 35.29L19.62 36.36L19.66 36.40Q20.78 36.14 21.62 35.62L21.71 35.71L24.02 35.74L24.32 34.68L24.49 34.85Q28.44 33.65 30.14 30.52L30.06 30.44L30.14 30.52Q34.29 27.17 30.82 21.20L30.66 21.04L30.81 21.19Q29.12 21.03 28.09 20.29L28.11 20.31L27.94 20.14Q34.52 14.01 28.44 13.60L28.48 13.64L27.40 12.77Z\"/><path fill=\"#dd54dd\" d=\"M116.07 12.76L115.94 12.63Q114.02 13.39 112.47 13.37L112.43 13.33L112.33 13.23Q105.57 20.67 107.91 29.56L107.93 29.59L109.25 29.78L109.33 29.86Q109.65 30.93 108.54 30.75L108.47 30.68L108.49 31.83L110.44 32.39L110.37 32.32Q109.52 33.68 113.16 36.22L113.19 36.25L115.47 36.29L117.41 36.27L118.28 36.29L118.32 36.33Q118.76 33.60 121.55 33.94L121.68 34.07L121.84 32.55L122.28 32.45L123.00 31.77L122.82 30.17L122.81 30.17Q124.54 27.35 124.16 24.51L124.19 24.53L125.09 24.31L125.00 23.37L124.94 23.31Q124.74 23.00 124.77 22.58L124.62 22.44L124.81 21.78L124.75 21.71Q123.76 19.93 123.78 18.51L123.92 18.66L123.94 18.67Q122.18 16.36 121.93 14.41L121.88 14.36L121.87 14.36Q119.99 14.24 118.93 13.10L118.78 12.95L118.87 13.04Q117.32 13.08 116.02 12.71L116.12 12.80ZM113.60 17.30L113.58 17.28Q119.38 16.70 120.42 21.87L120.47 21.92L120.45 21.90Q121.03 22.32 121.45 22.06L121.36 21.97L121.26 21.87Q122.30 27.56 119.34 31.75L119.35 31.76L119.37 31.77Q117.16 33.73 114.87 32.32L115.00 32.45L114.95 32.40Q114.16 33.52 113.49 32.34L113.43 32.29L113.49 32.35Q111.30 32.30 111.19 30.05L111.17 30.03L111.26 30.12Q109.95 29.96 109.07 29.32L109.10 29.34L109.65 28.49L109.52 28.36Q108.44 24.20 110.38 21.94L110.40 21.97L110.51 22.07Q110.39 18.34 113.41 17.11L113.50 17.20Z\"/><path fill=\"#eb734b\" d=\"M54.31 12.63L54.33 12.65Q47.09 15.30 48.04 22.60L47.97 22.53L48.06 22.61Q49.61 23.93 50.14 25.64L50.17 25.66L50.09 25.58Q55.09 26.78 58.80 24.89L58.80 24.89L59.67 26.21L59.49 26.04Q57.04 32.47 51.15 33.47L51.19 33.52L51.00 33.32Q50.00 34.79 50.23 36.32L50.14 36.23L50.22 36.31Q56.77 35.39 58.77 29.56L58.94 29.73L58.90 29.69Q61.41 27.80 60.77 24.97L60.73 24.92L61.17 25.14L61.29 25.25Q62.53 21.37 60.77 18.61L60.75 18.58L60.80 18.64Q60.54 13.04 54.31 12.63L54.47 12.79ZM53.04 16.31L53.01 16.27Q54.41 16.37 55.59 16.26L55.67 16.33L55.63 16.30Q56.39 17.48 57.92 17.41L57.86 17.35L57.89 17.39Q61.56 25.52 52.26 23.76L52.31 23.80L52.20 23.69Q51.31 22.04 50.31 21.10L50.44 21.23L50.32 21.11Q50.08 17.34 52.97 16.23L52.94 16.20Z\"/><path d=\"M3 28 C70 15,72 7,142 34\" stroke=\"#6d89dd\" fill=\"none\"/><path fill=\"#a570db\" d=\"M86.46 12.64L86.00 13.31L84.78 13.47L84.69 13.38Q84.19 13.55 83.78 13.38L83.76 13.36L78.50 13.77L78.18 14.81L78.14 14.77Q78.49 17.34 85.36 17.23L85.39 17.26L85.34 17.21Q83.61 20.13 81.39 21.21L81.34 21.16L81.24 23.56L82.66 24.51L82.65 24.50Q85.72 23.19 88.67 23.48L88.57 23.37L88.69 24.39L88.68 24.39Q89.92 25.07 88.67 28.02L88.65 28.00L87.35 28.08L87.47 28.20Q85.31 31.83 81.39 32.11L81.36 32.08L81.38 32.11Q79.97 32.96 78.31 32.89L78.42 33.00L78.36 32.94Q77.72 34.05 77.78 35.30L77.75 35.27L78.73 36.26L78.88 36.42Q79.93 36.09 80.77 35.57L80.82 35.62L83.19 35.71L83.66 34.82L83.53 34.69Q87.51 33.52 89.22 30.39L89.28 30.46L89.35 30.53Q93.49 27.16 90.02 21.20L89.94 21.11L90.04 21.22Q88.24 20.95 87.21 20.21L87.12 20.13L87.25 20.26Q93.72 14.01 87.65 13.60L87.67 13.63L86.63 12.81Z\"/></svg> --- Comment by @tkez on Apr 23, 2019 Had a fix on my case (that rect with % width height) by editing some code in parser_state.dart, bool addShape(XmlStartElementEvent event){...} --- Comment by @Juthisarker on Jul 23, 2019 Any fixing solution on this issue? --- Comment by @p30arena on Jul 26, 2019 flutter_svg: ^0.13.1 ``` Warning: Flutter SVG only supports the following formats for `width` and `height` on the SVG root: width="100%" width="100px" width="100" (where the number will be treated as pixels). The supplied value (394pt) will be discarded and treated as if it had not been specified. ``` --- Comment by @lavahasif on Sep 16, 2019 Not a solution. In my case my Genuine path is :assets/image/target.svg.i did write like this assets/target.svg. That time i got this like message.I feel someone help this . --- Comment by @georgikoemdzhiev on Nov 12, 2019 > flutter_svg: ^0.13.1 > > ``` > Warning: Flutter SVG only supports the following formats for `width` and `height` on the SVG root: > width="100%" > width="100px" > width="100" (where the number will be treated as pixels). > The supplied value (394pt) will be discarded and treated as if it had not been specified. > ``` I am seeing exactly the same warning in *^0.14.4* as well --- Comment by @4handheld on Jan 20, 2020 Seems like the width and height attributes in the SVG file are responsible. Setting the values from 512 to 100 resolved the issue in my app. ie, from `<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">` to `<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">` --- Comment by @4handheld on Jan 20, 2020 Seems like the width and height attributes in the SVG file are responsible. Setting the values from 512 to 100 resolved the issue in my app. ie, from `<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">` to `<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">` --- Comment by @ZeeshanFareed123 on Feb 12, 2020 Fixed this warning by the following steps: 1. Open SVG image in android studio. 2. Change the width and height from "512px" to "256px" --- Comment by @alvindrakes on Mar 2, 2020 @ZeeshanFareed123 Yeap, I tried this solution and it works. But will the SVG look pixelated on a bigger screen? Since we specify it to 256px. --- Comment by @shafi49 on May 19, 2020 @ZeeshanFareed123 you are right. This error comes if it finds any values set as points instead of pixel or percentage. Please convert your points unit (pt) to pixels or percentage. I recommend using pixels. 1 pt = 1.333px. There are many handy converters out there too. [Here is one](https://www.ninjaunits.com/converters/pixels/points-pixels/) For example I changed this code ```` <svg height="384pt" viewBox="0 0 384.024 384" width="384pt" xmlns="http://www.w3.org/2000/svg"> ```` to this ```` <svg height="512px" viewBox="0 0 384.024 384" width="512px" xmlns="http://www.w3.org/2000/svg"> ```` Hope it helps. --- Comment by @Dlouki on Dec 11, 2020 this is code is work just change height="512pt" to height="512px" and width="384pt" to width="384px" --- Comment by @marcellocamara on Dec 17, 2020 I solved all this warnings removing the unity from height and width. Example: ``` height="512pt" => height="512" or height="512px" => height="512" ``` --- Comment by @alhamri on Feb 26, 2021 > @ZeeshanFareed123 you are right. This error comes if it finds any values set as points instead of pixel or percentage. Please convert your points unit (pt) to pixels or percentage. I recommend using pixels. > 1 pt = 1.333px. There are many handy converters out there too. [Here is one](https://www.ninjaunits.com/converters/pixels/points-pixels/) > > For example I changed this code > > ``` > <svg height="384pt" viewBox="0 0 384.024 384" width="384pt" xmlns="http://www.w3.org/2000/svg"> > ``` > > to this > > ``` > <svg height="512px" viewBox="0 0 384.024 384" width="512px" xmlns="http://www.w3.org/2000/svg"> > ``` > > Hope it helps. worked for me. I didn't change the numbers(values), just change (pt) to (px). --- Comment by @amkuchta on Mar 5, 2021 Converting `pt` to `px` or removing the "type" of measurement altogether isn't always an option. For example, using `FractionallySizeBox` as follows ```dart FractionallySizedBox( heightFactor: 0.75, child: SvgPicture.asset( 'assets/images/mendala.svg', color: Colors.white, semanticsLabel: 'A white mendala', ), ) ``` results in the following output: ``` I/flutter ( 5455): Warning: Flutter SVG only supports the following formats for `width` and `height` on the SVG root: I/flutter ( 5455): width="100%" I/flutter ( 5455): width="100px" I/flutter ( 5455): width="100" (where the number will be treated as pixels). I/flutter ( 5455): The supplied value (1280.000000pt) will be discarded and treated as if it had not been specified. I/flutter ( 5455): Warning: Flutter SVG only supports the following formats for `width` and `height` on the SVG root: I/flutter ( 5455): width="100%" I/flutter ( 5455): width="100px" I/flutter ( 5455): width="100" (where the number will be treated as pixels). I/flutter ( 5455): The supplied value (710.000000pt) will be discarded and treated as if it had not been specified. I/flutter ( 5455): unhandled element metadata; Picture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#c3801(), name: "assets/images/mendala.svg", colorFilter: null) ``` --- Comment by @lojithv on Jun 5, 2021 I found a solution for this. **Steps** 1. Wrap svg icon inside a container. ( Container should be a child widget) 2. Set color of the container to transparent. 3. Change the size of the container. (Svg icon inhert the size of parent widget.) **Example** ![svgsolution](https://user-images.githubusercontent.com/74459314/120886704-e3e0cd80-c60c-11eb-90e3-c28e10a05995.png) --- Comment by @JefersonSSouza on Jun 5, 2021 in my case I changed on svg file properties height and width, from mm to px, worked for me!! --- Comment by @followthemoney1 on Jun 8, 2021 only this was help for web when I was trying to set height or width: ``` FractionallySizedBox( heightFactor: procentIconSize, child: SvgPicture.asset( assetName, semanticsLabel: sectionName, color: Colors.white, ), ``` and no matter what icons size was: ``` <svg width="1477px" height="1884px" viewBox="0 0 1477 1884" ``` or ``` <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve"> ``` or ``` <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M11 ``` --- Comment by @JeanRoldanDev on Jul 12, 2021 ![image](https://user-images.githubusercontent.com/6289980/125220741-cac2e080-e28c-11eb-8179-69e18d792c4a.png) Remove height="422pt" and width="422pt" --- Comment by @brunoalfred on Aug 22, 2021 I face the same challenge but here is a simple workaround over the issue: Steps: 🔥☄️ 1. Go to your svg file and check the units used to specify `height` and `width` of your svg asset. 2. Make sure the units are either of these options; %, px ie change from width="100pt" to (width="100px" or width="100%" or width="100") 3. Rebuild your application and the error must have gone away. 4. Enjoy 🏃🏽‍♂️ flutter_svg
package,p: flutter_svg
low
Critical
2,655,883,079
flutter
[flutter_svg] SVG asset loading/rendering performance in PageView widget
_Imported from https://github.com/dnfield/flutter_svg/issues/111_ Original report by @raqbit on Feb 3, 2019 Hi, I'm relatively new to Flutter & could not really find how PageView handles rendering/loading it's child widgets, but when I use SvgPicture as a child of a PageView, I keep getting "lag spikes" from (I guess) the loading/rendering of the SVG. Currently I'm creating the SvgPicture widgets in `initState()` of a stateful widget and then using the PageView builder to add the to the PageView (This is a simplified example): ```dart class CardsPageView extends StatefulWidget { CardsPageView({Key key}) : super(key: key); final String title; @override CardsPageViewState createState() { return new CardsPageViewState(); } } class CardsPageViewState extends State<CardsPageView> { List<Widget> cards = []; @override void initState() { super.initState(); for (var i = 0; i < 10; i++) { cards.add(SomeCard(index: i)); } } @override Widget build(BuildContext context) { return PageView.builder( controller: controller, itemCount: cards.length, itemBuilder: (context, position) { return cards[position]; }, ); } } class SomeCard extends StatefulWidget { final int index; SomeCard({ Key key, this.index, }) : super(key: key); @override SomeCardState createState() { return new SomeCardState(); } } class SomeCardState extends State<SomeCard> { Widget cardArt; @override void initState() { super.initState(); cardArt = SvgPicture.asset("assets/${widget.index}.svg"); } @override Widget build(BuildContext context) { return Card( child: cardArt, ); } } ``` When using "Flutter Performance" in Android Studio I get this FPS graph while scrolling through the cards: ![image](https://user-images.githubusercontent.com/11144180/52175661-588a6f80-27a7-11e9-8622-a3a008dffe9d.png) Do you know what is causing these rendering delays & what would be the best way to fix them? --- Comment by @dnfield on Feb 4, 2019 Could you provide a full reproduction of this issue (perhaps a github repo with a working project)? I'd hazzard a guess that you probably don't want to create the `SvgPicture` in initState, but just do it in your build method. It should be caching the resulting picture, but I'm not sure if there's something else going on here preventing it from doing that. --- Comment by @raqbit on Feb 9, 2019 I uploaded the full source of the testing app here: https://github.com/Raqbit/stacked. It's worth noting that the spikes are worse at the beginning, as expected for a first load. Not sure how I would go about smoothing that part out. When you have loaded all SVGs in the PageView and scroll back though, there still are some spikes when scrolling. --- Comment by @anasiqbal on Apr 22, 2019 @dnfield Any update on this? --- Comment by @dnfield on Apr 22, 2019 If you want to preload the SVG, you should use `precachePicture`. If that's the bottleneck, do it early on and you should be fine. After that it depends on the complexity of the picture. Some SVGs aren't very performant. If you're drawing something with lots of paths and groups and group opacities and clips, it will be slow to redraw. You could try a repaint boundary, or you could rasterize it. --- Comment by @sroddy on Apr 26, 2019 @dnfield what is the suggested way to rasterize it? --- Comment by @dnfield on Apr 26, 2019 Hmm I thought I said this here but guess I didn't. I would start by adding a Repaint boundary over the bigger SVGs and see if that takes care of it --- Comment by @enricobenedos on Nov 1, 2019 I’m also having some performance issue with load from assets. I’m using a rotation animation that during the execution continuously switch between two svg files. Probably the files are a little bit complex (76kb) but I need to find a method to improve the performance. Probably it is better to preload the two svg files and then use them. Anyway there is performance issue related to rendering that is not fast --- Comment by @OPJP on Feb 7, 2020 > Repaint boundary Reduce The Image resolution and this should significantly improve performance --- Comment by @MisterJimson on May 13, 2020 I am also seeing performance issues when a parent of my Svg widget is setting state. I've tried wrapping in a RepaintBoundary and did not see significant changes. I've tried optimizing the SVG with a few tools as well. --- Comment by @MisterJimson on May 13, 2020 Another thing thats interesting. If I set the `SvgPicture.asset` height or width to a much smaller amount than I want the performance issues pretty much go away. In my use case the width and height I want to render at is around 375w 163h. If I set the height to 20 the performance is fine, but its obviously too small for my UI. --- Comment by @apoleo88 on Jun 10, 2020 I am having the same performance issue with `SvgPicture.asset` I am using it on a scrollable ListView, 40 SVGs are displayed at a time (size 64x64). The page appears excessively overloaded. --- Comment by @MisterJimson on Jun 11, 2020 I was able to resolve my issue my asking a designer to optimize the SVG in Illustrator. I no longer have issues except that I need to get every SVG specifically optimized. --- Comment by @andreidiaconu on Jul 22, 2020 @MisterJimson Can you recommend an app / command / process for optimizing SVGs that worked for you? Thanks --- Comment by @MisterJimson on Jul 22, 2020 Unfortunately all of the open sources tools and apps I found didn’t do a good enough job. Our designer modified the SVG before exporting it from their design tool. --- Comment by @AleksandarSavic95 on Oct 9, 2020 Here is a useful post about precaching assets: https://kangabru.xyz/2020/05/29/zero-to-hero-2.html#preload-svgs basically, do this for every asset ``` Future.wait([ precachePicture( ExactAssetPicture( SvgPicture.svgStringDecoder, 'assets/my_icon.svg',), null, ), // ... ]); ``` --- Comment by @apoleo88 on Oct 9, 2020 I want to show them in a scrollable list. If I have to precache them all, I will encounter latency in the start and severe memory problems, with the risk of crashing the app. --- Comment by @dnfield on Oct 9, 2020 @apoleo88 avoid using SVGs that have embedded images, and see if you can use something like SVG cleaner to shrink down your size. But yes, at some point you do have to choose between frame latency and how much you can pre-warm. --- Comment by @maheshwaran-p on Oct 18, 2022 Hi we have created one tool to solve this issue. Hope this tool will help for the better use of svg to the flutter developers . try it out : https://svg2widget.web.app/ post related to the tool : https://www.linkedin.com/posts/maheshwaran-p_flutterdeveloper-flame-fluttercommunity-activity-6987966041922449408-cge_?utm_source=share&utm_medium=member_desktop this tool will convert the svg into flutter code . --- Comment by @apoleo88 on Oct 18, 2022 > Hi I have created one tool to solve this issue. > > Hope this tool will help for the better use of svg to the flutter developers . > > try it out : https://svg2widget.web.app/ > > post related to the tool : https://www.linkedin.com/posts/maheshwaran-p_flutterdeveloper-flame-fluttercommunity-activity-6987966041922449408-cge_?utm_source=share&utm_medium=member_desktop > > this tool will convert the svg into flutter code . I haven't tested it properly, but this seems to increase the size of the SVGs by at least 30%. I am not sure of the impact on the size of the finished bundle. --- Comment by @maheshwaran-p on Oct 19, 2022 thanks for letting me know apoleo88 size of the svg is adjustable . Container( color: Colors.white, height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, child: Center( child: CustomPaint( painter: CandyPainter(40), size: Size.zero, ), // child: Container() )); you can change the size of the svg by editing this line ---->[painter: CandyPainter( size of the svg )]. you can download the sample project . https://github.com/maheshwaran-p/samplesvg/ --- Comment by @olegyablokov on Apr 12, 2023 Any updates? --- Comment by @maheshwaran-p on Apr 13, 2023 update on what? @olegyablokov --- Comment by @moBai20 on May 31, 2023 any solution for this issue ? --- Comment by @maheshwaran-p on May 31, 2023 > > Hi I have created one tool to solve this issue. > > Hope this tool will help for the better use of svg to the flutter developers . > > try it out : https://svg2widget.web.app/ > > post related to the tool : https://www.linkedin.com/posts/maheshwaran-p_flutterdeveloper-flame-fluttercommunity-activity-6987966041922449408-cge_?utm_source=share&utm_medium=member_desktop > > this tool will convert the svg into flutter code . > > I haven't tested it properly, but this seems to increase the size of the SVGs by at least 30%. I am not sure of the impact on the size of the finished bundle. No by using this svg2flutter you can reduce the app bundle size . Instead svg file you are going to use flutter code . --- Comment by @moBai20 on May 31, 2023 > > > Hi I have created one tool to solve this issue. > > > Hope this tool will help for the better use of svg to the flutter developers . > > > try it out : https://svg2widget.web.app/ > > > post related to the tool : https://www.linkedin.com/posts/maheshwaran-p_flutterdeveloper-flame-fluttercommunity-activity-6987966041922449408-cge_?utm_source=share&utm_medium=member_desktop > > > this tool will convert the svg into flutter code . > > > > > > I haven't tested it properly, but this seems to increase the size of the SVGs by at least 30%. I am not sure of the impact on the size of the finished bundle. > > No by using this svg2flutter you can reduce the app bundle size . Instead svg file you are going to use flutter code . how use this tool with svg image --- Comment by @maheshwaran-p on May 31, 2023 > > > > Hi I have created one tool to solve this issue. > > > > Hope this tool will help for the better use of svg to the flutter developers . > > > > try it out : https://svg2widget.web.app/ > > > > post related to the tool : https://www.linkedin.com/posts/maheshwaran-p_flutterdeveloper-flame-fluttercommunity-activity-6987966041922449408-cge_?utm_source=share&utm_medium=member_desktop > > > > this tool will convert the svg into flutter code . > > > > > > > > > I haven't tested it properly, but this seems to increase the size of the SVGs by at least 30%. I am not sure of the impact on the size of the finished bundle. > > > > > > No by using this svg2flutter you can reduce the app bundle size . Instead svg file you are going to use flutter code . > > how use this tool with svg image it's very simple . just select any svg , tool will convert the svg as flutter code . I have provided how to use section in this tool . <img width="1440" alt="Screen Shot 2023-05-31 at 5 39 54 PM" src="https://github.com/dnfield/flutter_svg/assets/62535697/e89abd55-ae7e-4c9b-b017-853f9ee84946"> sample project code : https://github.com/maheshwaran-p/samplesvg/ --- Comment by @maheshwaran-p on May 31, 2023 please checkout my example/sample project( https://github.com/maheshwaran-p/samplesvg/ ) to know it's full flow .if any further query feel free to reach :)
package,p: flutter_svg
low
Critical
2,655,883,261
flutter
[flutter_svg] SvgPicture.network test succeeds erroneously, log shows failure.
_Imported from https://github.com/dnfield/flutter_svg/issues/114_ Original report by @acherkashyn on Feb 12, 2019 Seen on flutter_svg commit 283a10240cd3331af7ebde31333e4afee83ae2bc: Steps: * run "SvgPicture.network" test. Observe log Result: * Test passes, but there's an exception logged: ``` ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════ The following TestFailure object was thrown running a test (but after the test had completed): Expected: one widget whose rasterized image matches golden image "golden_widget/flutter_logo.network.png" Actual: ?:<zero widgets with key [GlobalKey#d17e0] (ignoring offstage widgets)> Which: does not match When the exception was thrown, this was the stack: #0 fail (package:test_api/src/frontend/expect.dart:160:30) #1 _expect.<anonymous closure> (package:test_api/src/frontend/expect.dart:135:9) #24 _MatchesGoldenFile.matchAsync.<anonymous closure> (package:flutter_test/src/matchers.dart) <asynchronous suspension> #25 AutomatedTestWidgetsFlutterBinding.runAsync.<anonymous closure> (package:flutter_test/src/binding.dart:755:22) #28 AutomatedTestWidgetsFlutterBinding.runAsync (package:flutter_test/src/binding.dart:753:26) #29 _MatchesGoldenFile.matchAsync (package:flutter_test/src/matchers.dart:1652:20) #31 _MatchesGoldenFile.matchAsync (package:flutter_test/src/matchers.dart:1634:28) #32 _expect (package:test_api/src/frontend/expect.dart:122:26) #33 expectLater (package:test_api/src/frontend/expect.dart:76:5) #34 expectLater (package:flutter_test/src/widget_tester.dart:189:10) #35 _checkWidgetAndGolden (file:///Users/acherkashyn/Documents/workspace/source/flutter_svg/test/widget_svg_test.dart:17:9) #37 _checkWidgetAndGolden (file:///Users/acherkashyn/Documents/workspace/source/flutter_svg/test/widget_svg_test.dart:13:35) #38 main.<anonymous closure>.<anonymous closure> (file:///Users/acherkashyn/Documents/workspace/source/flutter_svg/test/widget_svg_test.dart:204:13) #52 AutomatedTestWidgetsFlutterBinding.asyncBarrier (package:flutter_test/src/binding.dart:921:23) #53 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:567:5) #74 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:909:17) #76 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:897:35) (elided 75 frames from class _FakeAsync, package dart:async, and package stack_trace) ════════════════════════════════════════════════════════════════════════════════════════════════════ ``` Expected: * Test should fail --- Comment by @dnfield on Feb 12, 2019 You're very likely getting this because you're not running on master. Unfortunately, I have to pick some version of Flutter to keep goldens up to date with. Skia ends up introducing subtle anti-aliasing changes every so often that break the tests. I end up regenerating them off of master and figure it will eventually be right. Are you sure the test is passing though? If I run the test it seems ok. --- Comment by @acherkashyn on Feb 13, 2019 @dnfield I'm running the test in Android Studio on a Mac computer, it shows green/passed. I've seen goldens not evaluating properly if you run tests on a different platform, so that is understandable if you've generated them on linux or windows. But the test passes, even though this failure is printed in log, so I think the setup is broken somehow, maybe expectLater() takes longer to complete, and the test doesn't wait for that. --- Comment by @dnfield on Feb 13, 2019 Ahh ok, I'll try to take a look when I can
package,p: flutter_svg
low
Critical
2,655,883,380
flutter
[flutter_svg] SVG with nested <svg> elements isn't rendering
_Imported from https://github.com/dnfield/flutter_svg/issues/132_ Original report by @bbedward on Mar 7, 2019 Hi, I have an SVG that is only partially rendering - I'm not sure why. In this case, only the feet of the monkey in the image are rendering with flutter_svg 0.12.0 Problematic SVG: https://www.dropbox.com/s/f5krj9osezwp0sg/test.svg?dl=0 Thanks for the help! --- Comment by @dnfield on Mar 7, 2019 Can you just paste the content of the SVG here directly? I can't seem to access that link properly. --- Comment by @bbedward on Mar 7, 2019 Oh sorry, it's quite large so better to not paste it I think. Try this one: https://cdn.discordapp.com/attachments/490551255727603733/553284336527605770/test.svg --- Comment by @dnfield on Mar 7, 2019 Your SVG has multiple nested SVG elements. that's not supported at this time. You could probably get away with just changing all the nested `<svg>` tags to `<g>`s. None of them are actually changing the viewBox. --- Comment by @dnfield on Mar 7, 2019 Ah, no you can't just do a new <g>, but unfortunately this kind of SVG isn't supported. I haven't seen a lot of demand for it, but if you want to create a PR to make it work I'd review it. --- Comment by @bbedward on Mar 10, 2019 Thanks for the response, I was able to change the format of the SVGs as you suggested and they work without nested <svg> elements now. --- Comment by @dnfield on Mar 10, 2019 I'll keep this open to track nested `<svg>` elements. Right now it's lower priority for me because I'm not sure how many people really want it compared to, say, filter effects. But If it gets enough upvotes here I'll rethink that :) --- Comment by @ikbendewilliam on Aug 25, 2022 @bbedward I've added your svg to the example project and as golden in https://github.com/dnfield/flutter_svg/pull/754 if this is an issue please let me know and I'll search for another test image 😁 --- Comment by @0xmove on Jun 30, 2023 @ikbendewilliam This SVG `ipfs://bafkreidj2yju4jmrzxw4dkzcsxgyfhzwywumxwoqntcpkabjli4njy6lky` still doesn't display properly. --- Comment by @ikbendewilliam on Jun 30, 2023 @0xmove My PR didn't merge as @dnfield moved away from the implementation in favour of the new (and better) [vector_graphics](https://github.com/dnfield/vector_graphics) package, which is now used behind the scenes AFAIK. --- Comment by @phamconganh on Jun 15, 2024 @ikbendewilliam i tried you PR to [vector_graphics](https://github.com/dnfield/vector_graphics) with some small fixes, it shows the nested svgs but in the wrong position (child svg not in the right position) ![Screen Shot 2024-06-15 at 15 02 15](https://github.com/dnfield/flutter_svg/assets/28704713/7ea2d395-ae9e-4034-867d-ee3e4f61380c) original svg ![Screen Shot 2024-06-15 at 15 02 38](https://github.com/dnfield/flutter_svg/assets/28704713/20071343-2e3a-4202-9041-a7c5de7e4296) ``` <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="50" height="50" fill="blue" /> <svg x="70" y="70" width="50" height="50"> <circle cx="25" cy="25" r="20" fill="red" /> </svg> </svg> ```
package,p: flutter_svg
low
Minor
2,655,883,507
flutter
[flutter_svg] Stroke width looks off
_Imported from https://github.com/dnfield/flutter_svg/issues/176_ Original report by @DenisShakinov on Jun 14, 2019 I have a simple svg file as follows: ``` <svg xmlns="http://www.w3.org/2000/svg" width="74" height="74" viewBox="0 0 74 74"> <defs> <linearGradient id="a" x1="0%" y1="0%" y2="100%"> <stop offset="0%" stop-color="#FF7805"/> <stop offset="100%" stop-color="#FF0202"/> </linearGradient> </defs> <rect width="68" height="68" fill="none" fill-rule="evenodd" stroke="url(#a)" stroke-width="4.2" rx="29" transform="translate(3 3)"/> </svg> ``` In desktop svg viewer it renders like this: ![image](https://user-images.githubusercontent.com/2579593/59508460-b39b4400-8eb6-11e9-8e18-48ae7189c427.png) but in my flutter application it renders like a very thin line (gradients are correct though): ![image](https://user-images.githubusercontent.com/2579593/59508594-345a4000-8eb7-11e9-92c5-03a96b9b6fc0.png) --- Comment by @dnfield on Jun 14, 2019 What if you remove the width/height attributds from the svg element? --- Comment by @DenisShakinov on Jun 14, 2019 Nothing changed. --- Comment by @dnfield on Jun 14, 2019 What version are you using? --- Comment by @DenisShakinov on Jun 14, 2019 Since I'm using stable Flutter channel, the flutter_svg version is ^0.12.4+2 --- Comment by @thisisgit on Jul 9, 2020 I'm facing the same issue and looks like it's because passing width and height arguments to **SvgPicture** just scales up/down the original svg asset. For example, here's a sample close icon in svg: ``` <svg xmlns="http://www.w3.org/2000/svg" width="15.414" height="15.414" viewBox="0 0 15.414 15.414"> <g transform="translate(0.707 0.707)"> <line x2="14" y2="14" stroke="#000000" stroke-linecap="round" stroke-width="1"/> <line x2="14" y2="14" transform="translate(14) rotate(90)" stroke="#000000" stroke-linecap="round" stroke-width="1"/> </g> </svg> ``` Note that both lines have stroke width of 1. And it looks like this when rendered: <img width="41" alt="close" src="https://user-images.githubusercontent.com/13231564/86993553-3fc58b00-c1df-11ea-9a75-2b6de93b6318.png"> I was expecting lines to have stroke width of 1 even width and height of the image changes. So with the following code: ``` Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ SvgPicture.asset( 'assets/close_icon.svg', width: 16, height: 16, ), SizedBox( width: 16.0, ), SvgPicture.asset( 'assets/close_icon.svg', width: 64.0, height: 64.0, ) ], ) ``` I expected output to be: <img width="134" alt="right" src="https://user-images.githubusercontent.com/13231564/86994090-8798e200-c1e0-11ea-8f12-0baec314b5b5.png"> But what rendered was: <img width="127" alt="uhoh" src="https://user-images.githubusercontent.com/13231564/86994100-92ec0d80-c1e0-11ea-9d34-dfce1f6fb63a.png"> I thought setting width and height value would change the width and height attribute of svg tag. But what it did was to just scale up/down. Is there any proper way to achieve this or is it a new feature request? Please correct me if I'm getting this wrong. @dnfield --- Comment by @liri2006 on Dec 16, 2020 Same issue here. --- Comment by @njovy on May 3, 2021 @dnfield I am having the same issue as well. Is there any workaround for this? If a stroke refers a linear gradient, then it doesn't render correctly. --- Comment by @njovy on May 3, 2021 @dnfield The latest version doesn't parse "stroke-width" if a stroke is a linearGradient, can we expect to see a bug fix soon? --- Comment by @dnfield on May 3, 2021 I'm not sure I ever got a clear reproduction on this that I could reproduce locally. I can try to look at it again though. --- Comment by @vishna on May 11, 2021 @thisisgit this is expected behaviour - you need another svg with scaled up values and with width in it that says `1` --- Comment by @njovy on Jul 29, 2021 @vishna If you look at the flutter svg code, the plugin doesn't parse ```stroke-width``` attribute if a stroke is a linearGradient. --- Comment by @aytunch on Feb 10, 2022 @njovy I have the exact same problem. There is a `stroke-width` inside a `linearGradient` and it only shows the vector without and width. Is there a workaround for this? --- Comment by @febryardiansyah on Jun 13, 2024 any update for this issue? --- Comment by @capsulekenny on Nov 1, 2024 Hi All, This is (in most cases) a misunderstanding in rendering behaviour. Basically, what is happening is the svg is rendered with its default props (in @thisisgit 's example, this is width="15.414" height="15.414" with stroke-width="1") and then scaled via the SvgPicture package. This package, along with most other packages in other languages, renders the svg at it's original size and then scales to the passed width/height props. An easy work around is to take the svg as a string and edit all instances of stroke-width at runtime. Fun fact: the SvgImage package can take an entire svg as a string - this is why this method works. I have attached an example below where I used this method to build an icon widget for use in a component library I'm building. In the example, I have used size tokens but these can be replaced with any double. ```dart import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter/services.dart' show rootBundle; import '/abstracts/dimension/size_tokens.dart'; class AcaraIcon extends StatefulWidget { final String iconPath; final Color? color; final double size; // customizable width & height final double strokeWidth; // customizable stroke width const AcaraIcon({ Key? key, required this.iconPath, this.color, this.size = size24, this.strokeWidth = stroke2, // Default stroke width }) : super(key: key); @override AcaraIconState createState() => AcaraIconState(); } // State used to fetch svg as string at runtime class AcaraIconState extends State<AcaraIcon> { String? svgString; @override void initState() { super.initState(); loadSvgWithCustomStroke(widget.strokeWidth); } Future<void> loadSvgWithCustomStroke(double strokeWidth) async { // Load the SVG file as a string String svgData = await rootBundle.loadString(widget .iconPath); //if optimisation errors occur, check this implementation. So far, no perfrormance issues // Replace the stroke-width dynamically svgData = svgData.replaceAll( RegExp(r'stroke-width="[^"]*"'), 'stroke-width="$strokeWidth"', ); setState(() { svgString = svgData; }); } @override Widget build(BuildContext context) { // Render the SVG directly from asset initially; switch to svgString when ready return svgString == null ? SvgPicture.asset( widget.iconPath, width: widget.size, height: widget.size, colorFilter: widget.color != null ? ColorFilter.mode(widget.color!, BlendMode.srcIn) : null, ) // Render the updated string with new stroke width : SvgPicture.string( svgString!, // this is raw svg as string width: widget.size, height: widget.size, colorFilter: widget.color != null ? ColorFilter.mode(widget.color!, BlendMode.srcIn) : null, ); } } ``` Context: I also have a design background and discovered this difference in behaviour between programatic envs vs. design envs. Another fun fact: When using programs like Figma, the software renders the path/shape at its literal size meaning if you were to set size to any other double, the stroke stays at its literal value (in the above case "1") - a way to get around this is to use scale tools so you know how the icon will behave when scaled. Hope this helped!
package,p: flutter_svg
low
Critical
2,655,883,623
flutter
[flutter_svg] Add benchmarks
_Imported from https://github.com/dnfield/flutter_svg/issues/179_ Original report by @Vardiak on Jun 18, 2019 I think it could interesting to include benchmarks of this package in comparaison with Chrome rendering engine running on a similar device. --- Comment by @dnfield on Jun 20, 2019 Benchmarks would be great. I don't have a ton of time for that at the moment unfortunately, but would be happy to accept PRs. Otherwise I'll try to get to it eventually. Really, they'd be best so we could measure improvements int he code and what impact they're having on compute/memory usage.
package,p: flutter_svg
low
Minor
2,655,892,181
flutter
[flutter_svg] fill-opacity in groups not rendering
_Imported from https://github.com/dnfield/flutter_svg/issues/184_ Original report by @gmaggio on Jun 24, 2019 **Fill-opacity** does not render when in **groups**. - Flutter SVG **0.12.4+2** - Dart SDK 2.3.0-dev.0.5.flutter-a1668566e5 - Flutter SDK 1.5.4-hotfix.2 (Stable) ## Code with bug: > Note: `fill-opacity` in `g` tag ```svg <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20"> <g fill="none" fill-rule="evenodd"> <g fill="#000"> <path id="a" d="M12.805 12.069c0 .569-.457 1.03-1.02 1.03s-1.02-.461-1.02-1.03c0-.57.457-1.031 1.02-1.031s1.02.46 1.02 1.03"/> </g> <g fill="#000"> <path id="c" d="M16.89 17.623H3.14a.778.778 0 0 1-.764-.772V7.59c0-.419.35-.773.764-.773h13.75c.415 0 .765.354.765.773v2h-6.361c-1.353 0-2.453 1.112-2.453 2.479 0 1.366 1.1 2.477 2.453 2.477h6.36v2.305c0 .419-.35.772-.764.772zM15.127 2.419a.776.776 0 0 1 .702.103.658.658 0 0 1 .284.544v2.209H6.926l8.2-2.856zm2.529 11.356h-6.361a1.7 1.7 0 0 1-1.69-1.706 1.7 1.7 0 0 1 1.69-1.707h6.36v3.413zm-.015-8.362V3.03a2.187 2.187 0 0 0-.932-1.77 2.289 2.289 0 0 0-2.078-.3h-.001L2.114 5.315a.768.768 0 0 0-.49.555 2.313 2.313 0 0 0-.775 1.72v9.261c0 1.274 1.032 2.316 2.292 2.316h13.75c1.26 0 2.291-1.042 2.291-2.316V7.59c0-1.008-.648-1.86-1.541-2.177z"/> </g> <g> <g fill="#000" fill-opacity=".2"> <path id="e" d="M7.71 16.851c0 .772.764.772.65.772H4.126c-.408 0-.743 0-1.03-.01a.775.775 0 0 1-.719-.762V7.59c0-.404.326-.738.718-.763.288-.008.623-.01 1.031-.01h4.348c-.764 0-.764.773-.764.773v9.261zm3.055-11.577h-3.84l3.84-1.336v1.336z"/> </g> </g> <path d="M0 0h20v20H0z"/> </g> </svg> ``` ![svg_opacity_bug](https://user-images.githubusercontent.com/127763/60002171-5b242d80-9692-11e9-95d3-3e2f0d8514af.png) ## Fixed code: > Note: `fill-opacity` in `path` tag ```svg <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20"> <g fill="none" fill-rule="evenodd"> <g fill="#000"> <path id="a" d="M12.805 12.069c0 .569-.457 1.03-1.02 1.03s-1.02-.461-1.02-1.03c0-.57.457-1.031 1.02-1.031s1.02.46 1.02 1.03"/> </g> <g fill="#000"> <path id="c" d="M16.89 17.623H3.14a.778.778 0 0 1-.764-.772V7.59c0-.419.35-.773.764-.773h13.75c.415 0 .765.354.765.773v2h-6.361c-1.353 0-2.453 1.112-2.453 2.479 0 1.366 1.1 2.477 2.453 2.477h6.36v2.305c0 .419-.35.772-.764.772zM15.127 2.419a.776.776 0 0 1 .702.103.658.658 0 0 1 .284.544v2.209H6.926l8.2-2.856zm2.529 11.356h-6.361a1.7 1.7 0 0 1-1.69-1.706 1.7 1.7 0 0 1 1.69-1.707h6.36v3.413zm-.015-8.362V3.03a2.187 2.187 0 0 0-.932-1.77 2.289 2.289 0 0 0-2.078-.3h-.001L2.114 5.315a.768.768 0 0 0-.49.555 2.313 2.313 0 0 0-.775 1.72v9.261c0 1.274 1.032 2.316 2.292 2.316h13.75c1.26 0 2.291-1.042 2.291-2.316V7.59c0-1.008-.648-1.86-1.541-2.177z"/> </g> <g> <g fill="#000"> <path id="e" fill-opacity=".2" d="M7.71 16.851c0 .772.764.772.65.772H4.126c-.408 0-.743 0-1.03-.01a.775.775 0 0 1-.719-.762V7.59c0-.404.326-.738.718-.763.288-.008.623-.01 1.031-.01h4.348c-.764 0-.764.773-.764.773v9.261zm3.055-11.577h-3.84l3.84-1.336v1.336z"/> </g> </g> <path d="M0 0h20v20H0z"/> </g> </svg> ``` ![svg_opacity_fixed](https://user-images.githubusercontent.com/127763/60002334-a50d1380-9692-11e9-88df-ca9bf69b7d1b.png) However, **Flutter SVG 0.10.0** doesn't seem to have this bug. --- Comment by @dnfield on Jun 24, 2019 Thanks - I had to rework how opacity was handled for groups between these versions,a nd probably missed something here. Will take a look. --- Comment by @dnfield on Jun 25, 2019 The spec is a little ambiguous here. `fill-opacity` and `stroke-opacity` are defined as applying to shape and textual elements, but `<g>` is documented as being able to have those as properties. The properties themselves aren't documented as requiring the same compositing properties as `opacity` on a group. That said, Chrome handles this the same way as if `opacity` had been applied to the `g`. I'm a little worried about the expense of this, but it should be doable. That said, it's also a pretty big change- right now, groups just ask their shapes to draw paths and fills at the same time. I think to achieve this they'll have to composite them separately. --- Comment by @psyanite on Sep 6, 2019 Hi @dnfield, firstly I want to say how grateful and amazing this library this. I just wanted to say I recently upgraded from v0.6.3 to v0.14.0. I have a heart shape (path) that has a white stroke outline. ``` <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="#484848" fill-opacity="0.15" stroke="#ffffff" stroke-width="2.5" focusable="false" stroke-linecap="round" stroke-linejoin="round" style="height: 24px; width: 24px; display: block; overflow: visible;"> <g> <path d="m23.99 2.75c-.3 0-.6.02-.9.05-1.14.13-2.29.51-3.41 1.14-1.23.68-2.41 1.62-3.69 2.94-1.28-1.32-2.46-2.25-3.69-2.94-1.12-.62-2.27-1-3.41-1.14a7.96 7.96 0 0 0 -.9-.05c-1.88 0-7.26 1.54-7.26 8.38 0 7.86 12.24 16.33 14.69 17.95a1 1 0 0 0 1.11 0c2.45-1.62 14.69-10.09 14.69-17.95 0-6.84-5.37-8.38-7.26-8.38" /> </g> </svg> ``` This is a minor issue but, previously `fill-opacity` would work but it is no longer working (it is rendered as 100% opacity in Flutter). In IntelliJ I can see it's clearly working in the SVG preview. I've since moved `fill-opacity` as an attribute on <path> and it is now working expectedly.
package,p: flutter_svg
low
Critical
2,655,892,515
flutter
[flutter_svg] Document svg-convert as a solution for cleaning up svgs
_Imported from https://github.com/dnfield/flutter_svg/issues/197_ Original report by @bsutton on Jul 19, 2019 I note in the readme you mention a couple of tools (scour, usvg) as options to clean up svg files. We had a no. of svg files that contained css and the above tools were no help if resolving the issue. We found the npm package svg-convert fixed the files. I thought it might be worth updating the readme to mention this tool: [svg-style-converter](https://www.npmjs.com/package/svg-style-converter) To install the tool: sudo apt install npm sudo npm i svg-style-converter -g To run the tool svg-convert <inputfile> <outputfile> --- Comment by @dnfield on Jul 19, 2019 Sounds good, would you mind opening a PR with changes to the readme? --- Comment by @misterfourtytwo on Nov 18, 2020 package with this name is not found on npm anymore
package,p: flutter_svg
low
Minor
2,655,892,893
flutter
[flutter_svg] Support deleting a specific cache entry by key
_Imported from https://github.com/dnfield/flutter_svg/issues/201_ Original report by @jlcool on Jul 27, 2019 How to Delete Cache --- Comment by @jlcool on Jul 27, 2019 FilePicture Operator in SvgPicture. File Support File Size Judgment ``` dart file?.lengthSync() == typedOther.file?.lengthSync ``` --- Comment by @jlcool on Jul 27, 2019 Because I changed the svg, but the picture path has not changed. I hope the plug-in can make some changes. Thank you. This is machine translation. I hope you can understand it. --- Comment by @dnfield on Jul 27, 2019 It looks like there's nothing publically exposed to clear the cache. I've added `PictureProvider.clearCache()`. There's one other thing I want to land now before I publish, but should publish a new version soon. --- Comment by @jlcool on Jul 28, 2019 I don't know if I understand what you mean. I hope there is a way to delete the cache according to the key. See if this can be used https://api.flutter.dev/flutter/painting/ImageCache/evict.html。Let's also deal with this problem ->SvgPicture. File,Looking forward to the next version --- Comment by @jlcool on Jul 28, 2019 ` PictureProvider.clearCache() ` can help me, thank you. --- Comment by @GeylanKalafMohe on May 10, 2023 We can use this code to clear all cache from the `flutter_svg: ^2.0.4`: ``` import 'package:flutter_svg/flutter_svg.dart; svg.cache.clear(); ```
package,p: flutter_svg
low
Minor
2,655,893,268
flutter
[flutter_svg] Confusing Exception message while precaching Picture with wrong Asset name
_Imported from https://github.com/dnfield/flutter_svg/issues/215_ Original report by @feinstein on Aug 14, 2019 I want to pre-cache a `Picture` so it won't blink in place once I navigate to the screen that shows this `Picture`, so I just pre-cache it before navigating. I used the following (wrong) code (pre-caching a big Image and some SVGs): ```dart await precacheImage(Image.asset('assets/b&w.png').image, context); await precachePicture(SvgPicture.asset('assets/b&w.png').pictureProvider, context); ``` While copy&pasting I forgot to change the name of the asset to `assets/logo.svg` and I got this error: >Exception: FormatException: Bad UTF-8 encoding 0x89 (at offset 0) at this line: ```dart final String data = await key.bundle.loadString(key.name); ``` Where `key.name` was `assets/b&w.png`. The error was pretty cryptic but I eventually figured out. I am just opening this issue because I think the error message could indicate better what went wrong, like `Asset is not an SVG`. --- Comment by @dnfield on Aug 14, 2019 This is a good idea - we could just catch the FormatException and rethrow one that indicates this may not be an SVG. Does that sound right to you? --- Comment by @feinstein on Aug 14, 2019 I think its perfect.
package,p: flutter_svg
low
Critical
2,655,893,703
flutter
[flutter_svg] <font> tag not supported
_Imported from https://github.com/dnfield/flutter_svg/issues/222_ Original report by @ridz0n3 on Sep 13, 2019 Hi, I try to put svg img that contain text, but it like render not properly in app.. this in img viewer in android studio, it should look like this: <img width="337" alt="Screenshot 2019-09-13 at 9 07 10 PM" src="https://user-images.githubusercontent.com/8773669/64865076-1abdc580-d66b-11e9-9469-e00d8ce5c29a.png"> and this when i run in app: <img width="464" alt="Screenshot 2019-09-13 at 9 10 06 PM" src="https://user-images.githubusercontent.com/8773669/64865139-404acf00-d66b-11e9-8327-3b920d271a74.png"> the font that i use is `PT Sans Narrow`, i also add this font in my project. and this is the original img: https://github.com/ridz0n3/Animation/blob/master/magCover.svg can u help me @dnfield ? thanks --- Comment by @dnfield on Sep 13, 2019 At first glance, this is using letter spacing properties, which aren't supported. I'd be happy to review.a PR that adds them. At the end of the day though, you'll probably only get full fidelity by rendering all the glyphs as paths into the SVG. Text is hard to get right in a cross platform way --- Comment by @ridz0n3 on Sep 17, 2019 > At first glance, this is using letter spacing properties, which aren't supported. I'd be happy to review.a PR that adds them. > > At the end of the day though, you'll probably only get full fidelity by rendering all the glyphs as paths into the SVG. Text is hard to get right in a cross platform way @dnfield i already remove letter spacing properties..but the font still not changing....is it `<glyphs>, <font>, <font-face>, <defs>` tags support? --- Comment by @dnfield on Sep 17, 2019 Yes, glyphs aren't supported yet --- Comment by @ridz0n3 on Sep 17, 2019 > Yes, glyphs aren't supported yet @dnfield so how to do it? is it to convert all text into vector? --- Comment by @dnfield on Sep 17, 2019 Ahh I missed this earlier - the whole `font` tag isn't supported right now. You could either render the text into paths (I think Inkscape has an option for that), or you could create a regular (e.g. TTF) font from the font data and include it in your assets. --- Comment by @ridz0n3 on Sep 19, 2019 alrite...thanks.
package,p: flutter_svg
low
Minor
2,655,894,082
flutter
[flutter_svg] Incorrect image size when setting both width and height in conjunction with BoxFit.contain
_Imported from https://github.com/dnfield/flutter_svg/issues/229_ Original report by @fl0cke on Sep 25, 2019 Setting both width and height in conjunction with BoxFit.contain leads to incorrect image dimensions. Example code: ``` SvgPicture.asset( 'some_image.svg', height: 64, width: 64, fit: BoxFit.contain, ) ``` According to the documentation of [BoxFit.contain](https://api.flutter.dev/flutter/painting/BoxFit-class.html), the box should be sized as large as possible while still containing the source entirely within the target dimensions. However, if the width of some_image.svg is larger than 64 pixels, the resulting SvgPicture grows beyond its specified dimensions of 64x64. It seems like this is caused by the following code in svg.dart: ``` double width = widget.width; double height = widget.height; if (width == null && height == null) { width = viewport.width; height = viewport.height; } else if (height != null) { width = height / viewport.height * viewport.width; <- width is overwritten } else if (width != null) { height = width / viewport.width * viewport.height; } ``` There should be no viewport calculations whatsoever if both width and height are given.
package,p: flutter_svg
low
Minor
2,655,894,930
flutter
[flutter_svg] would love to use this lib to do a one-time migration of SVG=>Flutter
_Imported from https://github.com/dnfield/flutter_svg/issues/261_ Original report by @csells on Dec 9, 2019 For dynamic images, you want to parse what you have. However, for migration of SVG assets to Flutter, it would be great to have a way to get an intermediate representation out of your library to use to dump a Flutter widget implementation from an SVG file. From such an IR, one could easily build a CLI tool that did the work. --- Comment by @krolaw on Feb 16, 2020 I'm looking forward to this too, as I imagine this would decrease footprint and increase rendering speed.
package,p: flutter_svg
low
Minor
2,655,895,677
flutter
[flutter_svg] Support SVG in `<image>` tag.
_Imported from https://github.com/dnfield/flutter_svg/issues/267_ Original report by @ThinkDigitalSoftware on Dec 21, 2019 this error is thrown attempting to render this svg. https://img.shields.io/github/stars/felangel/bloc.svg?style=flat&logo=github&colorB=deeppink&label=stars ### Code: ```dart SvgPicture.network( 'https://img.shields.io/github/stars/felangel/bloc.svg?style=flat&logo=github&colorB=deeppink&label=stars'); ``` ### Exception ``` ════════ Exception caught by SVG ═══════════════════════════════════════════════════════════════════ The following _Exception was thrown resolving a single-frame picture stream: Exception: Could not instantiate image codec. When the exception was thrown, this was the stack: #0 _futurize (dart:ui/painting.dart:4338:5) #1 instantiateImageCodec (dart:ui/painting.dart:1718:10) #2 resolveImage.<anonymous closure> (package:flutter_svg/src/svg/parsers.dart:204:31) #3 resolveImage (package:flutter_svg/src/svg/parsers.dart:218:23) #4 _Elements.image (package:flutter_svg/src/svg/parser_state.dart:443:31) ... Picture provider: NetworkPicture("https://img.shields.io/github/stars/felangel/bloc.svg?style=flat&logo=github&colorB=deeppink&label=stars", headers: null, colorFilter: null) Picture key: NetworkPicture("https://img.shields.io/github/stars/felangel/bloc.svg?style=flat&logo=github&colorB=deeppink&label=stars", headers: null, colorFilter: null) ``` --- Comment by @dnfield on Dec 21, 2019 This is using an `<image>` tag that actually has another SVG inside it. --- Comment by @ThinkDigitalSoftware on Dec 22, 2019 I thought that it was weird that the content type was image/svg. So what should I understand? That's its an SVG or that it's an Image? --- Comment by @ThinkDigitalSoftware on Dec 22, 2019 Oh, ok. So it's just something you need to support? --- Comment by @dnfield on Dec 22, 2019 Right --- Comment by @ThinkDigitalSoftware on Dec 22, 2019 Ok,got it. Thanks! --- Comment by @ThinkDigitalSoftware on Dec 28, 2019 Having issues with this url as well. https://img.shields.io/discord/649708778631200778.svg?logo=discord&color=blue --- Comment by @jeiea on Mar 2, 2023 I'm experiencing the exact symptoms in the title, albeit with a different problem. I converted svg containing png as data url with `dart run vector_graphics_compiler -i`, the original svg was over 1MB and it only came out to 80kB. --- Comment by @dnfield on Mar 3, 2023 > I'm experiencing the exact symptoms in the title, albeit with a different problem. I converted svg containing png as data url with `dart run vector_graphics_compiler -i`, the original svg was over 1MB and it only came out to 80kB. Is it rendering correctly? SVGs generally encode image data as base64. VG just stores the binary version of the image and saves a bit of space that way. @jeiea if you can share the SVG I'd be interested in seeing it. It's possible it had lots of other "noise" that VG strips out, but that'd be a lot more than I'd expect. --- Comment by @jeiea on Mar 3, 2023 No, just picture is not shown.. https://fastupload.io/CznUYrI1JYEeT7N/file --- Comment by @dnfield on Mar 3, 2023 That site does not work for me. Can you attach it to this issue? --- Comment by @jeiea on Mar 3, 2023 . --- Comment by @dnfield on Mar 3, 2023 Vector Graphics oly supports PNG images right now. Adding JPEG wouldn't be hard.
package,p: flutter_svg
low
Critical
2,655,896,143
flutter
[flutter_svg] Invalid double 1pt
_Imported from https://github.com/dnfield/flutter_svg/issues/271_ Original report by @binoysarker on Jan 6, 2020 I just installed flutter_svg in flutter and apply this code ` trailing: FutureBuilder( future: this ._worldTimeService .getFlag(this.allTimeZones[index].split('/').first), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.data != null) { return SizedBox( child: SvgPicture.network( snapshot.data, width: 50.0, height: 50.0, allowDrawingOutsideViewBox: false, ), ); } else { // print(snapshot.data); return Text('no image'); } }), ` **Now my problem is that this data is in list view and it is loading some svg flags in a list view. After scrolling i get this error. Please tell me how to solve this. Thanks. ** --- Comment by @dnfield on Jan 6, 2020 Flutter_svg does not support or values. --- Comment by @kevin4dhd on Mar 30, 2022 any solution?
package,p: flutter_svg
low
Critical
2,655,896,621
flutter
[flutter_svg] Canvas docs are unclear / confusing
_Imported from https://github.com/dnfield/flutter_svg/issues/282_ Original report by @shamilovtim on Jan 28, 2020 These are the docs to make an SVG canvas compatible: ``` import 'package:flutter_svg/flutter_svg.dart'; final String rawSvg = '''<svg viewBox="...">...</svg>'''; final DrawableRoot svgRoot = await svg.fromSvgString(rawSvg, rawSvg); // If you only want the final Picture output, just use final Picture picture = svgRoot.toPicture(); // Otherwise, if you want to draw it to a canvas: // Optional, but probably normally desirable: scale the canvas dimensions to // the SVG's viewbox svgRoot.scaleCanvasToViewBox(canvas); // Optional, but probably normally desireable: ensure the SVG isn't rendered // outside of the viewbox bounds svgRoot.clipCanvasToViewBox(canvas); svgRoot.draw(canvas, size); ``` I'm not understanding several things here. What is "rawSvg" and where is the invocation to get the svg from our `assets/file.svg`? Furthermore, when I try to render the SVG to a widget it is not an `Image` so I don't see how I can use `canvas.drawImage` to render it. Use case: looking to get an *.svg file that I can draw to a canvas. --- Comment by @dnfield on Jan 28, 2020 You use `svgRoot.draw` and give it the canvas. `rawSvg` is a string here. You could load it from a file - or just use the `SvgPicture.file` or `SvgPicture.asset`. I'd be happy to review an improvement to the docs here. --- Comment by @shamilovtim on Jan 28, 2020 if I try to do this: ``` final String rawSvg = SvgPicture.asset('assets/egg.svg'); ``` I get: `A value of type 'SvgPicture' can't be assigned to a variable of type 'String'.` If I try `.toString()` or `toStringDeep()` all I get is a string of "SvgPicture" not the actual svg paths. I can try by reading a File as well --- Comment by @dnfield on Jan 28, 2020 Ahh sorry, you'd want loadAsset for that. SvgPicture is a widget you just put in the tree --- Comment by @shamilovtim on Jan 28, 2020 Cool, will do! --- Comment by @emvaized on Mar 29, 2020 @dnfield I am sorry, could you please give a full example snippet on the discussed situation? For example, I have an `svg` file with some path data, and how can I draw it on canvas? I'm a bit confused with your answer, especially on what `loadAsset` is. And also `svgRoot.draw(canvas, size)` method gives an error to me, saying that it must accept three arguments instead of two. Thanks. --- Comment by @AamirVakeel on Apr 29, 2020 @dnfi > Ahh sorry, you'd want loadAsset for that. Can you please explain this thing? I am trying to place an SVG over a canvas so we can draw on it but i have an svg file and >final String rawSvg = '''<svg viewBox="...">...</svg>'''; This line isn't working out for me as i have a file. --- Comment by @alectogeek on May 16, 2020 @aamirvakeel1 you should load your asset file like this: `rootBundle.loadString(assetRoute)`
package,p: flutter_svg
low
Critical
2,655,897,032
flutter
[flutter_svg] How to scale an image to fill whole width?
_Imported from https://github.com/dnfield/flutter_svg/issues/291_ Original report by @wellbranding on Feb 11, 2020 I have an svg image, which has the height and width of 60 pixels. However, I would like to set it's the **width to full screen** in Flutter. How can I achieve such behaviour? Also, can I zoom the image even more than full width? Suppose my image is 2000 pixels as SVG and I would like to see only the middle part of that image (about 600 pixels). Again, thanks for this amazing plugin! --- Comment by @krolaw on Feb 18, 2020 `<svg height="100%" width="100%">` `<svg height="100%" width="100%" viewBox="700 700 600 600">`
package,p: flutter_svg
low
Minor
2,655,897,438
flutter
[flutter_svg] Missing argument parentPaint
_Imported from https://github.com/dnfield/flutter_svg/issues/295_ Original report by @liyuqian on Feb 18, 2020 The doc references `parentPaint`, but there's no `parentPaint` in the entire repo other than that doc: https://github.com/dnfield/flutter_svg/search?q=parentPaint&unscoped_q=parentPaint
package,p: flutter_svg
low
Minor
2,655,897,843
flutter
[flutter_svg] Support <switch> element.
_Imported from https://github.com/dnfield/flutter_svg/issues/304_ Original report by @zbolo-wd on Mar 4, 2020 --- Comment by @maniveltvl on Mar 19, 2020 Hi, Team I am trying to load SVG raw content using `SvgPicture.string(rawSvg)` but it is not loaded. My SVG content has switch value. If I load the same SVG content in browser it is working but it is not working in this plugin. Can you please help me on this?
package,p: flutter_svg
low
Minor
2,655,898,238
flutter
[flutter_svg] Regression: a shape element with no color some opacity is rendering as solid black now
_Imported from https://github.com/dnfield/flutter_svg/issues/307_ Original report by @dnfield on Mar 9, 2020 E.g. ```svg <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 264"> <rect width="264" height="264" fill="lightblue"/> <path d="M184.32,121.12H79.38v8H184.32Z" opacity="0.1" /> </svg> ``` No longer renders correctly after #306 Unfortunately there was no test covering this. /cc @pento --- Comment by @stact on Sep 15, 2020 @pento @dnfield it seems that it's fixed with this shared sample. But got some unexpected effect on this sample: https://avataaars.io/
package,team-engine,p: flutter_svg
low
Minor
2,655,898,622
flutter
[flutter_svg] svg large file
_Imported from https://github.com/dnfield/flutter_svg/issues/316_ Original report by @vassilux on Mar 25, 2020 Hi alls, I try to process a large (about 5Mo) svg file from network and application freeze. This is link for file : https://french-riviera-tattoo-convention.com/spacecontrol/longjumeau.svg Any idea? --- Comment by @dnfield on Mar 25, 2020 I would generally avoid trying to decode a 5mb SVG on a mobile device. That said, this does load reasonably well in Chrome on Android, and Flutter should be able to do about as well. I do not expect to work on this any time soon, but would be happy to review proposals ot make the parsing/rendering work better for this kind of scenario. --- Comment by @vassilux on Mar 25, 2020 ok , thank for your answer My target is to use DXF files in my application so that I tried to convert DXF to svg for little POC if you have any idea ?
package,p: flutter_svg
low
Minor
2,655,899,054
flutter
[flutter_svg] flutter_svgCC not support centerSlice .
_Imported from https://github.com/dnfield/flutter_svg/issues/323_ Original report by @SiNguyen0604 on Apr 1, 2020 Hi all. I want use properties centerSlice for image svg . Can you add properties centerSlice to flutter_svg ? or any similar properties use in flutter_svg . Can u help me @dnfield ? --- Comment by @dnfield on Apr 1, 2020 This is definitely doable, although I doubt I'll be able to get to it anytime soon. I'm also not clear on whether it's really worth the complexity it entails. For raster images, it helps save on disk space (you can have a small square image that scales to any size without extra disk space). With SVG, it doesn't really save you on size so much, and it should be trivial to just scale the SVG itself (if you're scaling in both dimensions), or to just construct the right SVG for what you want with minimal extra disk space. --- Comment by @SiNguyen0604 on Apr 6, 2020 Hi @dnfield thank your reply . I understand but current SVG image it scale follow image SVG . I want similar property like centerSlice . Do you support me?
package,p: flutter_svg
low
Minor
2,655,899,475
flutter
[flutter_svg] SvgPicture.asset test fails when debugDumpApp is used
_Imported from https://github.com/dnfield/flutter_svg/issues/324_ Original report by @pszklarska on Apr 2, 2020 I'm trying to write tests for the widgets that use SvgPicture. The following test can be run successfully: ``` import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('svg picture test', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( home: SvgPicture.asset( 'images/icon_percent.svg', ), )); expect(find.byType(SvgPicture), findsOneWidget); }); } ``` However, when I add `debugDumpApp` method to print current widgets' tree, test fails: ``` import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('svg picture test', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( home: SvgPicture.asset( 'images/icon_percent.svg', ), )); debugDumpApp(); expect(find.byType(SvgPicture), findsOneWidget); }); } ``` The exception stack trace is: ``` AutomatedTestWidgetsFlutterBinding - CHECKED MODE ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════ The following assertion was thrown running a test: type 'PictureStream' is not a subtype of type 'Diagnosticable' Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause. In either case, please report this assertion by filing a bug on GitHub: https://github.com/flutter/flutter/issues/new?template=BUG.md When the exception was thrown, this was the stack: #0 DiagnosticableMixin.toDiagnosticsNode (package:flutter/src/foundation/diagnostics.dart:3113:14) #1 DiagnosticableMixin.toString.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:3095:20) #2 DiagnosticableMixin.toString (package:flutter/src/foundation/diagnostics.dart:3097:6) #3 DiagnosticsProperty.valueToString (package:flutter/src/foundation/diagnostics.dart:2698:61) #4 DiagnosticsProperty.toDescription (package:flutter/src/foundation/diagnostics.dart:2712:21) #5 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1170:31) #6 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1280:39) #7 DiagnosticsNode.toStringDeep (package:flutter/src/foundation/diagnostics.dart:1709:7) #8 DiagnosticsNode.toString (package:flutter/src/foundation/diagnostics.dart:1632:14) #9 DiagnosticableMixin.toString.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:3095:78) #10 DiagnosticableMixin.toString (package:flutter/src/foundation/diagnostics.dart:3097:6) #11 DiagnosticsProperty.valueToString (package:flutter/src/foundation/diagnostics.dart:2698:61) #12 DiagnosticsProperty.toDescription (package:flutter/src/foundation/diagnostics.dart:2712:21) #13 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1170:31) #14 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1280:39) #15 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #16 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #17 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #18 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #19 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #20 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #21 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #22 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #23 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #24 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #25 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #26 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #27 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #28 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #29 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #30 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #31 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #32 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #33 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #34 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #35 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #36 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #37 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #38 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #39 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #40 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #41 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #42 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #43 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #44 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #45 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #46 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #47 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #48 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #49 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #50 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #51 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #52 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #53 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #54 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #55 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #56 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #57 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #58 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #59 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #60 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #61 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #62 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #63 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #64 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #65 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #66 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #67 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #68 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #69 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #70 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #71 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #72 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #73 TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1336:33) #74 DiagnosticsNode.toStringDeep (package:flutter/src/foundation/diagnostics.dart:1709:7) #75 DiagnosticableTree.toStringDeep (package:flutter/src/foundation/diagnostics.dart:3406:32) #76 debugDumpApp (package:flutter/src/widgets/binding.dart:883:58) #77 main.<anonymous closure> (file:///Users/paulinaszklarska/Projects/cca-mobile-app/test/agreements/agreement_details/example_test.dart:13:5) <asynchronous suspension> #78 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:124:25) #79 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:696:19) <asynchronous suspension> #82 TestWidgetsFlutterBinding._runTest (package:flutter_test/src/binding.dart:679:14) #83 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:1050:24) #89 AutomatedTestWidgetsFlutterBinding.runTest (package:flutter_test/src/binding.dart:1047:15) #90 testWidgets.<anonymous closure> (package:flutter_test/src/widget_tester.dart:121:22) #91 Declarer.test.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:171:27) <asynchronous suspension> #92 Invoker.waitForOutstandingCallbacks.<anonymous closure> (package:test_api/src/backend/invoker.dart:242:15) #97 Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:239:5) #98 Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:169:33) #103 Declarer.test.<anonymous closure> (package:test_api/src/backend/declarer.dart:168:13) #104 Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:392:25) #118 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19) #119 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5) #120 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12) (elided 28 frames from class _FakeAsync, package dart:async, package dart:async-patch, and package stack_trace) ``` --- Comment by @tigertore on May 7, 2020 I see the same issue when using the flutter inspector. If I click on a widget that contains a SvgPicture it dumps this stack trace and the widget and all its children can't be inspected: ════════ Exception caught by Flutter framework ═════════════════════════════════════════════════════ The following assertion was thrown during a service extension callback for "ext.flutter.inspector.getDetailsSubtree": type 'PictureStream' is not a subtype of type 'Diagnosticable' Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause. In either case, please report this assertion by filing a bug on GitHub: https://github.com/flutter/flutter/issues/new?template=BUG.md When the exception was thrown, this was the stack: #0 DiagnosticableMixin.toDiagnosticsNode (package:flutter/src/foundation/diagnostics.dart:3113:14) #1 DiagnosticableMixin.toString.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:3095:20) #2 DiagnosticableMixin.toString (package:flutter/src/foundation/diagnostics.dart:3097:6) #3 DiagnosticsProperty.valueToString (package:flutter/src/foundation/diagnostics.dart:2698:61) #4 DiagnosticsProperty.toDescription (package:flutter/src/foundation/diagnostics.dart:2712:21) ... ════════════════════════════════════════════════════════════════════════════════════════════════════ --- Comment by @dnfield on May 7, 2020 What version of Flutter are you on? There were changes to both Flutter svg and Flutter recently that are impacting this. --- Comment by @tigertore on May 8, 2020 This is on flutter stable channel version 1.12.13+hotfix.9. flutter_svg: ^0.17.3+1 I will test it again when I have upgraded to flutter 1.17 --- Comment by @tigertore on May 8, 2020 In Flutter 1.17 this error is gone, and it is working as expected. --- Comment by @shinriyo on Aug 27, 2020 @pszklarska Hello You put the code before `expect` line. ``` await tester.pumpAndSettle(); ``` It waits drawing. --- Comment by @erickm32 on Apr 9, 2021 I'm having a similar problem on a integration test. Rendering a tree like so: ```dart ... Expanded( flex: 1, child: GestureDetector( onTap: () async => await doSomething(), child: Center( child: SvgPicture.asset( 'images/some.svg', key: Key('find_me'), ), ), ), ), ... ``` The widget tester is unable to find a widget to tap with the code: ```dart group('', () { testWidgets('', (tester) async { await tester.pumpWidget(MyWidget()); await tester.pumpAndSettle(); await tester.tap(find.byKey(Key('find_me'))); // await tester.tap(find.byType(SvgPicture).last); // this also doesn't work await tester.pumpAndSettle(); // expectations for the onTap... } ); }); ``` All that I get is an error: `The following StateError was thrown running a test:` `Bad state: No element` If I put an `await Future.delayed(Duration(seconds: 5));` to see the screen, the svg is rendered but, when clicking on it, on the console is printed: `No widgets found at Offset(171.4, 656.3).` Any hints on how to find it?
package,p: flutter_svg
low
Critical
2,655,899,902
flutter
[flutter_svg] Bad state: Expected to find Drawable with id url(#text-3).
_Imported from https://github.com/dnfield/flutter_svg/issues/325_ Original report by @chjsun on Apr 6, 2020 my svg is ``` <?xml version="1.0" encoding="UTF-8"?> <svg width="83px" height="18px" viewBox="0 0 83 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 55 (78076) - https://sketchapp.com --> <title>Family members of patients</title> <desc>Created with Sketch.</desc> <defs> <linearGradient x1="100%" y1="47.648425%" x2="0%" y2="52.351575%" id="linearGradient-1"> <stop stop-color="#3DC862" offset="0%"></stop> <stop stop-color="#8BD939" offset="100%"></stop> </linearGradient> <linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-2"> <stop stop-color="#FFFFFF" offset="0%"></stop> <stop stop-color="#DEFFE1" offset="100%"></stop> </linearGradient> <text id="text-3" font-family="PingFangSC-Regular, PingFang SC" font-size="9" font-weight="normal" fill="#FFFFFF"> <tspan x="18" y="13">患者家属/朋友</tspan> </text> <filter x="-0.8%" y="-3.8%" width="101.7%" height="115.4%" filterUnits="objectBoundingBox" id="filter-4"> <feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset> <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0933129371 0" type="matrix" in="shadowOffsetOuter1"></feColorMatrix> </filter> </defs> <g id="我的" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="切图" transform="translate(-345.000000, -35.000000)"> <g id="Family-members-of-patients" transform="translate(345.000000, 35.000000)"> <rect id="矩形" fill="url(#linearGradient-1)" x="0" y="0" width="83" height="18" rx="9"></rect> <circle id="椭圆形" fill="url(#linearGradient-2)" cx="9" cy="9" r="7"></circle> <text id="家" font-family="PingFangSC-Regular, PingFang SC" font-size="9" font-weight="normal" fill="#70C942"> <tspan x="5" y="13">家</tspan> </text> <g id="患者家属/朋友" fill="#FFFFFF" fill-opacity="1"> <use filter="url(#filter-4)" xlink:href="#text-3"></use> <use xlink:href="#text-3"></use> </g> </g> </g> </g> </svg> ``` --------------------------- ``` flutter: unhandled element filter; Picture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#d13e2(), name: "assets/image/home/test.svg", colorFilter: null) flutter: ══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════ flutter: The following StateError was thrown resolving a single-frame picture stream: flutter: Bad state: Expected to find Drawable with id url(#text-3). flutter: Have ids: (url(#我的), url(#切图), url(#Family-members-of-patients), ..., url(#椭圆形), url(#患者家属/朋友)) flutter: flutter: When the exception was thrown, this was the stack: flutter: #0 DrawableDefinitionServer.getDrawable (package:flutter_svg/src/vector_drawable.dart:577:7) flutter: #1 _Elements.use (package:flutter_svg/src/svg/parser_state.dart:154:34) flutter: #2 SvgParserState.parse (package:flutter_svg/src/svg/parser_state.dart:746:26) flutter: <asynchronous suspension> flutter: #3 SvgParser.parse (package:flutter_svg/parser.dart:14:60) flutter: #4 Svg.fromSvgString (package:flutter_svg/svg.dart:110:25) flutter: #5 Svg.svgPictureStringDecoder (package:flutter_svg/svg.dart:72:36) flutter: #6 SvgPicture.svgStringDecoder.<anonymous closure> (package:flutter_svg/svg.dart:531:15) flutter: #7 AssetBundlePictureProvider._loadAsync (package:flutter_svg/src/picture_provider.dart:456:12) flutter: <asynchronous suspension> flutter: #8 AssetBundlePictureProvider.load (package:flutter_svg/src/picture_provider.dart:434:43) flutter: #9 PictureProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter_svg/src/picture_provider.dart:326:17) flutter: #10 PictureCache.putIfAbsent (package:flutter_svg/src/picture_cache.dart:67:22) flutter: #11 PictureProvider.resolve.<anonymous closure> (package:flutter_svg/src/picture_provider.dart:324:16) flutter: #12 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:38:29) flutter: #13 PictureProvider.resolve (package:flutter_svg/src/picture_provider.dart:321:24) flutter: #14 _SvgPictureState._resolveImage (package:flutter_svg/svg.dart:641:10) flutter: #15 _SvgPictureState.didChangeDependencies (package:flutter_svg/svg.dart:615:5) flutter: #16 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4376:12) flutter: #17 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #19 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5551:32) flutter: #20 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #21 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #22 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #23 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #24 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #25 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #27 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #28 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #29 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #30 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #31 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #32 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #33 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #34 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #35 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #36 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #37 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #38 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #39 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #40 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #41 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #42 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #43 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #44 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #45 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #46 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #47 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #48 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #49 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #50 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #51 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #52 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #53 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #54 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #55 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #56 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #57 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #58 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #59 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #60 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #61 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #62 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #63 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #64 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #65 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #66 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #67 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #68 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #69 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #70 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #71 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #72 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #73 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #74 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #75 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #76 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #77 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #78 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #79 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #80 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #81 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #82 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #83 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #84 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #85 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #86 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #87 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #88 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #89 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #90 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #91 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #92 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #93 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #94 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #95 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #96 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #97 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #98 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #99 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #100 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #101 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #102 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #103 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #104 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #105 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #106 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #107 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #108 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #109 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #110 ParentDataElement.mount (package:flutter/src/widgets/framework.dart:4617:11) flutter: #111 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #112 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5551:32) flutter: #113 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #114 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #115 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #116 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #117 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #118 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #119 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #120 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #121 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #122 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #123 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #124 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #125 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #126 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #127 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #128 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #129 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #130 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #131 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #132 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #133 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #134 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #135 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #136 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #137 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #138 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #139 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #140 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #141 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #142 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #143 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #144 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #145 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #146 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #147 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #148 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #149 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #150 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #151 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #152 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #153 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #154 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #155 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #156 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #157 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #158 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #159 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #160 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #161 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #162 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #163 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #164 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #165 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #166 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #167 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #168 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #169 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #170 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #171 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #172 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #173 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #174 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #175 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #176 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #177 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #178 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #179 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #180 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #181 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #182 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #183 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #184 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #185 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #186 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #187 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #188 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #189 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #190 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14) flutter: #191 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #192 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #193 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #194 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #195 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #196 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #197 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #198 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #199 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #200 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #201 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #202 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #203 ParentDataElement.mount (package:flutter/src/widgets/framework.dart:4617:11) flutter: #204 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #205 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #206 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #207 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #208 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #209 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11) flutter: #210 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #211 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #212 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #213 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16) flutter: #214 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) flutter: #215 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5) flutter: #216 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5) flutter: #217 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14) flutter: #218 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12) flutter: #219 SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1288:36) flutter: #220 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1273:20) flutter: #221 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2412:19) flutter: #222 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1266:11) flutter: #223 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:354:23) flutter: #224 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1823:58) flutter: #225 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:875:15) flutter: #226 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1823:13) flutter: #227 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:343:5) flutter: #228 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:427:5) flutter: #229 RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:196:12) flutter: #230 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #231 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:134:11) flutter: #232 _RenderSliverFractionalPadding.performLayout (package:flutter/src/widgets/sliver.dart:1165:11) flutter: #233 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #234 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:410:13) flutter: #235 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1367:12) flutter: #236 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1285:20) flutter: #237 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #238 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #239 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #240 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #241 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #242 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #243 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #244 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #245 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #246 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #247 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #248 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #249 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #250 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:163:11) flutter: #251 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:477:7) flutter: #252 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:232:7) flutter: #253 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:391:14) flutter: #254 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #255 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #256 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #257 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #258 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1232:11) flutter: #259 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #260 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #261 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #262 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #263 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #264 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #265 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #266 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #267 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #268 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #269 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3168:13) flutter: #270 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #271 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:505:15) flutter: #272 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #273 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #274 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #275 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #276 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #277 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #278 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #279 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #280 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #281 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #282 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #283 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #284 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #285 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:505:15) flutter: #286 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #287 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13) flutter: #288 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) flutter: #289 RenderView.performLayout (package:flutter/src/rendering/view.dart:167:13) flutter: #290 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1584:7) flutter: #291 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:844:18) flutter: #292 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:344:19) flutter: #293 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:774:13) flutter: #294 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:283:5) flutter: #295 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1102:15) flutter: #296 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1041:9) flutter: #297 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:850:7) flutter: #306 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19) flutter: #307 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5) flutter: #308 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12) flutter: (elided 8 frames from package dart:async and package dart:async-patch) flutter: flutter: Picture provider: ExactAssetPicture(name: "assets/image/home/test.svg", bundle: null, colorFilter: flutter: null) flutter: Picture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#d13e2(), name: flutter: "assets/image/home/test.svg", colorFilter: null) flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════ ``` --- Comment by @dnfield on Apr 6, 2020 Looks like the `text` handler isn't adding text in definitions. --- Comment by @chjsun on Apr 6, 2020 remove redundant code,same question ``` SvgPicture.asset("assets/image/home/test.svg", height: 80,), ``` ``` <?xml version="1.0" encoding="UTF-8"?> <svg width="83px" height="18px" viewBox="0 0 83 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <text id="text-3" font-size="9" fill="#FF0000"> <tspan x="18" y="13">患者家属/朋友</tspan> </text> </defs> <g id="test" fill-opacity="1"> <use xlink:href="#text-3"></use> </g> </svg> ``` ``` flutter: The following StateError was thrown resolving a single-frame picture stream: flutter: Bad state: Expected to find Drawable with id url(#text-3). flutter: Have ids: (url(#test)) ...... ``` and i hide text, but ![image](https://user-images.githubusercontent.com/13481443/78536396-5cd57100-7820-11ea-967e-53cf53ec43f7.png) @dnfield ,I don't know SVG very well,please help me if you can
package,p: flutter_svg
low
Critical
2,655,900,292
flutter
[flutter_svg] Using href to external local file within SvgPicture.string
_Imported from https://github.com/dnfield/flutter_svg/issues/332_ Original report by @BillTheGoat on Apr 21, 2020 I would like to use SVG sprite files for colored icons. Using the example flutter project, I can get an icon to load if I insert a `<use >` tag within the svg sprite file. The SVG below works using ``` const List<String> assetNames = <String>[ ... 'assets/simple/SVG-sprite-icons.svg', ]; ``` ``` <svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <symbol id="news" viewBox="0 -61 512 512"><title>news</title><path d="m452 390h-377c-41.359375 0-75-33.640625-75-75v-270c0-24.808594 20.191406-45 45-45h376.910156c4.46875 0 3.621094 1.960938 2.199219 5.101562-14.113281-1.375-27.109375 10.027344-27.109375 24.898438v300c0 29.742188 23.945312 55 55.351562 55 .039063 3.25-.0625 5-.351562 5zm0 0" fill="#e8efff"/><path d="m452 390h-225.820312v-390h195.730468c4.46875 0 3.621094 1.960938 2.199219 5.101562-14.109375-1.371093-27.109375 10.027344-27.109375 24.898438v300c0 29.738281 23.941406 55 55.351562 55 .039063 3.25-.0625 5-.351562 5zm0 0" fill="#ccdfff"/><path d="m197 180h-121c-8.285156 0-15 6.714844-15 15v120c0 8.285156 6.714844 15 15 15h121c8.285156 0 15-6.714844 15-15v-120c0-8.285156-6.714844-15-15-15zm0 0" fill="#ffc543"/><path d="m75 90h242c8.285156 0 15-6.714844 15-15s-6.714844-15-15-15h-242c-8.285156 0-15 6.714844-15 15s6.714844 15 15 15zm0 0" fill="#40b4f9"/><path d="m317 120h-242c-8.285156 0-15 6.714844-15 15s6.714844 15 15 15h242c8.285156 0 15-6.714844 15-15s-6.714844-15-15-15zm0 0" fill="#40b4f9"/><g fill="#0097f1"><path d="m317 180h-61c-8.285156 0-15 6.714844-15 15s6.714844 15 15 15h61c8.285156 0 15-6.714844 15-15s-6.714844-15-15-15zm0 0"/><path d="m317 240h-61c-8.285156 0-15 6.714844-15 15s6.714844 15 15 15h61c8.285156 0 15-6.714844 15-15s-6.714844-15-15-15zm0 0"/><path d="m317 300h-61c-8.285156 0-15 6.714844-15 15s6.714844 15 15 15h61c8.285156 0 15-6.714844 15-15s-6.714844-15-15-15zm0 0"/><path d="m332 75c0 8.28125-6.71875 15-15 15h-90.820312v-30h90.820312c8.28125 0 15 6.71875 15 15zm0 0"/><path d="m332 135c0 8.28125-6.71875 15-15 15h-90.820312v-30h90.820312c8.28125 0 15 6.71875 15 15zm0 0"/><path d="m497 90h-50v195c0 5.515625-4.484375 10-10 10h-40l-5 5v30c0 33.136719 26.863281 60 60 60s60-26.863281 60-60v-225c0-8.285156-6.714844-15-15-15zm0 0"/></g><path d="m392 30v270h45c8.285156 0 15-6.714844 15-15v-255c0-16.601562-13.484375-30.0507812-30.089844-30-16.53125.0507812-29.910156 13.464844-29.910156 30zm0 0" fill="#96beed"/></symbol> <use xlink:href="#news" x="0" y="0" /> </svg> ``` However I would like to be able to reference specific icons (`<symbol>` tags) programmatically. If I comment out the `<use>` tag and try the code below or variations on the href parameter (like `assets/flutter_assets/assets/simple/SVG-sprite-icons.svg#news`), I cannot get anything to display: ``` _painters.add(SvgPicture.string('''<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <use xlink:href="assets/simple/SVG-sprite-icons.svg#news" x="0" y="0" /> </svg>''')); ``` --- Comment by @BillTheGoat on Apr 21, 2020 I can work around this issue by saving the SVG without the `<use>` and closing tag as a `String` in a dart file, and then concatenating with the pertinent `<use>` and closing tags. Not ideal, but it loads. --- Comment by @bot509 on Apr 8, 2021 > I can work around this issue by saving the SVG without the `<use>` and closing tag as a `String` in a dart file, and then concatenating with the pertinent `<use>` and closing tags. Not ideal, but it loads. is the cpu performance and memory usage higher than rendering with separated svg files? --- Comment by @dnfield on Apr 8, 2021 Loading multiple files will always be more costly than loading a single file, especially when you need all the files in memory at once anyway.
package,p: flutter_svg
low
Major
2,655,927,919
flutter
[flutter_svg] Brazilian flag letters are a bit abnormal
_Imported from https://github.com/dnfield/flutter_svg/issues/337_ Original report by @LunaGao on May 1, 2020 When I working on https://github.com/LunaGao/flag_flutter/issues/10 this issue, I found those letters are a bit abnormal. ![image](https://user-images.githubusercontent.com/5066920/80823244-e1909080-8c0e-11ea-9b39-f548823321c6.png) Those letters should be like this: ![image](https://user-images.githubusercontent.com/5066920/80823359-1270c580-8c0f-11ea-9281-dad469da3433.png) This is the svg file. [br.svg.zip](https://github.com/dnfield/flutter_svg/files/4565339/br.svg.zip) --- Comment by @LunaGao on May 1, 2020 I'm using 0.17.4 version.
package,p: flutter_svg
low
Minor
2,655,928,047
flutter
[flutter_svg] evenOdd support for android vector drawables
_Imported from https://github.com/dnfield/flutter_svg/issues/340_ Original report by @HrX03 on May 5, 2020 i know this lib isnt really meant to handle android drawables, but it's the only lib i found yet that does this (partly) and i'd love to have the evenOdd fillType property supported properly. [This](https://del.dog/xagnyppebo.txt) is the vector i tried. It should look like [this](https://i.imgur.com/8LV39f2.png) but instead im getting it to show up like [this](https://i.imgur.com/mXaurpJ.jpg). Thanks for the nice project anyways
package,p: flutter_svg
low
Minor
2,655,928,192
flutter
[flutter_svg] Image not show completely
_Imported from https://github.com/dnfield/flutter_svg/issues/343_ Original report by @omidraha on May 7, 2020 Hi, I have this simple SVG file: ``` <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="375" height="407" viewBox="0 0 375 407"> <defs> <clipPath id="clip-path"> <rect id="Rectangle_2344" data-name="Rectangle 2344" width="375" height="407" transform="translate(0 177)" fill="#fff" stroke="#707070" stroke-width="1"/> </clipPath> </defs> <g id="_4" data-name="4" transform="translate(0 -177)" clip-path="url(#clip-path)"> <g id="Polygon_19" data-name="Polygon 19" transform="translate(15 177)" fill="#fff"> <path d="M 345.2359313964844 395.5 L 0.7640888690948486 395.5 L 173.0000152587891 1.248977780342102 L 345.2359313964844 395.5 Z" stroke="none"/> <path d="M 173.0000152587891 2.497894287109375 L 1.52813720703125 395 L 344.4718933105469 395 L 173.0000152587891 2.497894287109375 M 173.0000152587891 0 L 346 396 L 3.0517578125e-05 396 L 173.0000152587891 0 Z" stroke="none" fill="#707070"/> </g> <g id="Ellipse_659" data-name="Ellipse 659" transform="translate(42 269)" fill="#fff" stroke="#707070" stroke-width="1"> <ellipse cx="147" cy="152" rx="147" ry="152" stroke="none"/> <ellipse cx="147" cy="152" rx="146.5" ry="151.5" fill="none"/> </g> </g> </svg> ``` That looks like [this](https://i.ibb.co/THbcTLW/sample.png). But when I show it with this code: ``` import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: Sample(), ); } } class Sample extends StatelessWidget { @override Widget build(BuildContext context) { return Container( color: Colors.red, child: SvgPicture.asset( 'assets/images/sample.svg', ), ); } } ``` The result is just part of image: https://i.ibb.co/Qjc2XWh/sample-result.png I also try these attributes of `SvgPicture.asset`: `fit: BoxFit.cover`, `height`, `width`, `allowDrawingOutsideView` But still image not show completely. --- Comment by @dnfield on May 7, 2020 There's some bug in the way the transforms are getting handled for that clip path. Your SVG could be simplified as such: ``` <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="375" height="407" viewBox="0 0 375 407"> <g id="_4" data-name="4" transform="translate(0 -177)"> <g id="Polygon_19" data-name="Polygon 19" transform="translate(15 177)" fill="#fff"> <path d="M 345.2359313964844 395.5 L 0.7640888690948486 395.5 L 173.0000152587891 1.248977780342102 L 345.2359313964844 395.5 Z" stroke="none"/> <path d="M 173.0000152587891 2.497894287109375 L 1.52813720703125 395 L 344.4718933105469 395 L 173.0000152587891 2.497894287109375 M 173.0000152587891 0 L 346 396 L 3.0517578125e-05 396 L 173.0000152587891 0 Z" stroke="none" fill="#707070"/> </g> <g id="Ellipse_659" data-name="Ellipse 659" transform="translate(42 269)" fill="#fff" stroke="#707070" stroke-width="1"> <ellipse cx="147" cy="152" rx="147" ry="152" stroke="none"/> <ellipse cx="147" cy="152" rx="146.5" ry="151.5" fill="none"/> </g> </g> </svg> ``` and should render correctly that way, as well as being more performant. This is still a bug that should get fixed, but I'm not sure when I'll get to it right now. --- Comment by @omidraha on May 7, 2020 This `SVG` example is its output from `Adobe XD`, I have many pictures to export automatically by export option of `Adobe XD` as `SVG`. And I can't spend time on every `SVG` exported file that have many lines to simplify and I also don't now how to do it. Thanks for your reply,
package,p: flutter_svg
low
Critical
2,655,928,331
flutter
[flutter_svg] Unable to set dynamic color correctly
_Imported from https://github.com/dnfield/flutter_svg/issues/347_ Original report by @subnauez on May 12, 2020 Given the following SVG file, i.e. a parking map marker composed of 3 paths (a bubble, a white circle inside the bubble, a grey "P" letter inside the circle). ``` <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150"> <path fill="#999999" d="M53.15 95.79V26.7h22.38q12.72 0 16.58 1a18.17 18.17 0 0110 6.75c2.65 3.48 4 8 4 13.46a22.4 22.4 0 01-2.31 10.7 19 19 0 01-5.85 6.81 20.14 20.14 0 01-7.24 3.27 78.76 78.76 0 01-14.47 1h-9.1v26.1zm13.94-57.41V58h7.65q8.25 0 11-1.1a9.18 9.18 0 004.38-3.39 9.37 9.37 0 001.56-5.37 9 9 0 00-2.2-6.23 9.85 9.85 0 00-5.61-3.07 69.23 69.23 0 00-10-.47h-6.78z"/> <path fill="#000000" stroke="#FFFFFF" stroke-miterlimit="10" d="M134.86 62.48c0-33.79-26.8-61.18-59.86-61.18S15.14 28.69 15.14 62.48a61.58 61.58 0 0021.11 46.62L75 148.7l38.74-39.6a61.58 61.58 0 0021.12-46.62z"/> <path fill="#666666" stroke="#fff" stroke-miterlimit="10" d="M75 9.88a51.37 51.37 0 11-51.36 51.36A51.37 51.37 0 0175 9.88z"/> </svg> ``` We want to : - set the border color of the bubble according to parking state - keep the white circle inside the marker - keep the grey "P" letter inside the white circle Here is the code : ``` SvgPicture.network( URL semanticsLabel: 'Parking pin', color: Colors.red, //colorBlendMode: BlendMode.color, placeholderBuilder: (BuildContext context) => Container( padding: const EdgeInsets.all(30.0), child: const CircularProgressIndicator()), ) ``` Tried to play with colorBlendMode without success : - Once the marker is completly red (without white circle inside and "P" letter inside) - Once borders are red but the white circle becomes lightly red too Even if our designer followed the instructions for exporting the SVG file, I'm currently unable to get the correct result. Maybe SVG layers are not well formed ? Can anybody help for knowing what's going wrong please ? --- Comment by @donemerson on Nov 29, 2020 Any solution?
package,p: flutter_svg
low
Minor
2,655,928,485
flutter
[flutter_svg] Svg colors and alphas by regions
_Imported from https://github.com/dnfield/flutter_svg/issues/348_ Original report by @klaszlo8207 on May 18, 2020 Hello, I have an svg file that contains regions like: Lefthand, righthand, head, etc How can I colorize and set the alphas differently in the svg realtime? Thanks --- Comment by @klaszlo8207 on May 18, 2020 Basically I want to set the alpha to 15% on the left hand, 30% on the right hand, and so on. The color will be the same, grey Thanks --- Comment by @Tonku on Jun 27, 2020 Any update
package,p: flutter_svg
low
Minor
2,655,928,594
flutter
[flutter_svg] support `viewBox` on `symbol` elements.
_Imported from https://github.com/dnfield/flutter_svg/issues/366_ Original report by @georgi0u on Jun 22, 2020 I have an SVG that renders like so in Chrome: <img width="252" alt="Screen Shot 2020-06-22 at 9 59 33 AM" src="https://user-images.githubusercontent.com/197144/85330160-8d1bcb80-b46f-11ea-8034-662523610c6c.png"> And like so via flutter_svg: <img width="252" alt="Screen Shot 2020-06-22 at 9 59 47 AM" src="https://user-images.githubusercontent.com/197144/85330219-a4f34f80-b46f-11ea-9a77-9a4917423371.png"> The SVG markup is as follows: ``` <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-120 -168 240 336" preser\ veAspectRatio="none" class="card" face="AH" width="250" height="350"> <symbol id="HA" viewBox="-500 -500 1000 1000" preserveAspectRatio="xMinYMid"> <path d="M-270 460L-110 460M-200 450L0 -460L200 450M110 460L270 460M-120 130L120 130" stroke="red" stroke-width\ ="80" stroke-linecap="square" stroke-miterlimit="1.5" fill="none"/> </symbol> <rect width="239" height="335" x="-119.5" y="-167.5" rx="12" ry="12" fill="white" stroke="black"/> <use xlink:href="#HA" height="32" width="32" x="-114.4" y="-156"/> </svg> ``` --- Comment by @dnfield on Jul 31, 2020 The `viewBox` attribute isn't supported on symbols right now.
package,p: flutter_svg
low
Minor
2,655,928,724
flutter
[flutter_svg] Network error caused the image to fail to load and cannot be reloaded
_Imported from https://github.com/dnfield/flutter_svg/issues/367_ Original report by @Bedroome on Jun 23, 2020 If the network error causes the picture to fail to load, the picture cannot be reloaded after reconnecting to the network. Should some pictures be processed again after the picture fails to load, and when the picture fails to reload, the picture cannot be reloaded after didUpdateWidget, when this widget.pictureProvider At the same time, it cannot be loaded again, resulting in the picture being in the wrong state
package,p: flutter_svg
low
Critical
2,655,928,856
flutter
[flutter_svg] Change colors for multi color svg
_Imported from https://github.com/dnfield/flutter_svg/issues/372_ Original report by @Tonku on Jun 30, 2020 Thanks for the awesome library first!. I was wondering how can I change colours for a multi color svg for individual segments? Currently only one color is supported. Thanks --- Comment by @Tonku on Jun 30, 2020 See this website, they can change the color of svg https://undraw.co/illustrations how can I achieve that in flutter_svg --- Comment by @RussellZornes on Jul 19, 2020 You have style css support listed as out of scope. I hope you will consider at least supporting color styles as shown below. I have a bunch of svgs that are multi-color and the plugin renders them mono-colored. This is blocker for my use of this plugin and I've needed to revert all my svgs back to png 😩 ``` <?xml version="1.0" encoding="utf-8"?> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1024 1024" style="enable-background:new 0 0 1024 1024;" xml:space="preserve"> <style type="text/css"> .st0{fill:#333333;} .st1{fill:#9AC70A;} </style> <g> <path class="st0" d="M923.34,449.13v313.23c-58.44-10.63-105.78-53.08-123.25-108.69c-0.08-0.32-0.25-0.63-0.32-0.95 c-4.57-14.88-7.09-30.63-7.09-47.02c0-16.31,2.52-32.13,7.09-47.02c0.16-0.47,0.32-0.95,0.47-1.42 c11.03-34.5,33.48-63.95,63.01-83.72c6-4.02,12.21-7.64,18.75-10.87C894.91,456.38,908.77,451.81,923.34,449.13z"/> <polygon class="st1" points="744.84,426.1 588.97,471.85 438.61,515.96 198.01,586.53 188.24,553.13 174.34,505.64 182.74,505.17 182.81,505.17 296.54,498.86 728.93,372.06 727.9,368.52 "/> </g> </svg> ``` --- Comment by @Tonku on Jul 27, 2020 I think probably extract the paths of SVG and convert that to flutter paths and render ? --- Comment by @dnfield on Jul 31, 2020 Supporting CSS is, quite frankly, a nightmare and a full time job. It is generally possible to preprocess any CSS away as well. For the original request of this bug, I don't have any plans to support this but would be open to reviewing patches that added it in some reasonable way. However, in general you should be able to work with the `Drawable*` classes and transform the styles on them to your liking. It might be easier to do so if we surfaced some ID property on them that corresponded to the `id` attribute on elements. --- Comment by @Tonku on Aug 5, 2020 @dnfield that's what I wanted.. can you suggest a recommended way to hook the style of Drawable* class from outside of flutter_svg ? that's from my own code? --- Comment by @dnfield on Aug 5, 2020 From the readme: import 'package:flutter_svg/flutter_svg.dart'; final String rawSvg = '''<svg viewBox="...">...</svg>'''; final DrawableRoot svgRoot = await svg.fromSvgString(rawSvg, rawSvg); // If you only want the final Picture output, just use final Picture picture = svgRoot.toPicture(); // Otherwise, if you want to draw it to a canvas: // Optional, but probably normally desirable: scale the canvas dimensions to // the SVG's viewbox svgRoot.scaleCanvasToViewBox(canvas); // Optional, but probably normally desireable: ensure the SVG isn't rendered // outside of the viewbox bounds svgRoot.clipCanvasToViewBox(canvas); svgRoot.draw(canvas, size); --- Comment by @Tonku on Aug 15, 2020 Thanks so much --- Comment by @rgb1380 on Nov 11, 2020 > // outside of the viewbox bounds > svgRoot.clipCanvasToViewBox(canvas); > svgRoot.draw(canvas, size); Hi, fantastic lib, thanks heaps. Quick question, I am using svgRoot.draw() and it draws the svg in black. How do we change the color to something else? --- Comment by @gimmixAT on Jul 26, 2021 We also came across this issue and solved it for now by loading the svg's markup directly from the DefaultAssetBundle and preprocess it by replacing the color code that should be changed. So you just have to make sure that the fill / stroke is set correctly in your svg. Especially if you want to replace black because many svg optimizers will remove that since it is the svg internal default color. ```dart class Icon extends StatelessWidget { Icon(this.icon, {this.color = Colors.black}); final String icon; final Color color; @override Widget build(BuildContext context) { return FutureBuilder<String>( future: DefaultAssetBundle.of(context).loadString("assets/icons/" + icon + ".svg"), builder: (context, snapshot) { return SvgPicture.string( (snapshot.data ?? "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1 1\"></svg>") .replaceAll("#000000", '#${this.color.value.toRadixString(16).padLeft(6, '0').toUpperCase()}'), width: 32, ); } ); } } ``` --- Comment by @Zujaj on May 17, 2022 > See this website, they can change the color of svg https://undraw.co/illustrations how can I achieve that in flutter_svg Do you mean something like this? I call it SVG colorization. ![This is an image](https://cdn.hashnode.com/res/hashnode/image/upload/v1652540925611/aU4XY37Wh.gif) [This tutorial](https://zujaj.hashnode.dev/how-to-color-switch-an-svg-in-flutter) can help to solve your issue. Not only does it changes the color, but also allows the user to download the manipulated SVG code. --- Comment by @ultraon on Jan 27, 2023 Found great answer here https://stackoverflow.com/questions/73034225/flutter-svg-gradient-is-not-rendered-failed-to-find-definition-for-url : Just move `<def>` block to the top (just under `<svg>` element. --- Comment by @Chonli on Jul 6, 2023 You can create a custom ColorMapper supported many colors (see https://github.com/dnfield/flutter_svg/issues/856#issuecomment-1549320661) And juste use it in ``` SvgPicture( SvgAssetLoader( path, colorMapper: MyColorMapper( primaryColor: primaryColor, secondaryColor: secondaryColor, ), ), ``` --- Comment by @Sumit258000 on Sep 21, 2023 > SVG colorization What if we want to change color of particular classes in svg depending upon user selection? is there any short usefull function for that or the only possibility is searching class in long svg string and than change fill property? @Zujaj @dnfield --- Comment by @Zujaj on Sep 21, 2023 > > SVG colorization > > What if we want to change color of particular classes in svg depending upon user selection? is there any short usefull function for that or the only possibility is searching class in long svg string and than change fill property? @Zujaj @dnfield Can you provide any working example? --- Comment by @Sumit258000 on Sep 21, 2023 Thanks for your message but I found the workaround by setting condition and changing color dynamically something like this. `<g id="Mask_Group_533" data-name="Midfield" transform="translate(193.433 1654.703)" clip-path="url(#clip-path)"> <g id="Group_19878" data-name="Group 19878"> <ellipse id="Ellipse_1188" data-name="Ellipse 1188" cx="8.215" cy="8.215" rx="8.215" ry="8.215" fill='${position == "Midfield" ? "#3968FF" : "#b2b2b2"}' /> </g> </g>` By this I am able to change color separately in full svg string depending upon condition. --- Comment by @RahaKmi on Jan 25, 2024 Widget build(BuildContext context) { return FutureBuilder<String>( future: DefaultAssetBundle.of(context).loadString("packages/../assets/icons/${svgIcon.assetName}"), builder: (context, snapshot) { final String svgContent = snapshot.data ?? ''; final String modifiedSvgContent = svgContent.replaceAll('#4e737a', Theme.of(context).primaryColor.toHexColor()) .replaceAll('#f19926', 'red'); return SvgPicture.string( modifiedSvgContent, height: size, width: size, ); }, ); } extension ColorHex on Color { String toHexColor() { return '#${value.toRadixString(16).substring(2)}'; } } --- Comment by @RahaKmi on Jan 25, 2024 enum MyIcons { icon1(assetName: "icon1.svg"), icon2(assetName: "icon2.svg"), const MyIcons ({required this.assetName}); final String assetName; } class MyIcons extends Icon { final MyIcons svgIcon; const MyIcons ( this.svgIcon, { super.key, super.size = 24.0, }) : super(null);
package,p: flutter_svg
low
Critical
2,655,928,971
flutter
[flutter_svg] Loading large size svg will not be smooth
_Imported from https://github.com/dnfield/flutter_svg/issues/380_ Original report by @jazzyyoung on Jul 10, 2020 hello dear, First of all, this is a great component that helped me a lot, thank you very much.And I drew a large svg ,with a size of 1024*1024 and about 512k [maybe will be larger in th future :)]. However, after loading this large-sized svg, zooming in and out with my fingers will not be smooth, how to deal with it Thank you again. --- Comment by @dnfield on Jul 10, 2020 This library was designed primarily with smaller, simpler SVGs in mind - particularly icons. It should be possible to make that smooth, but I don't have plans to work on that anytime soon. I'd be happy to review PRs or design documents that suggested how to do it. --- Comment by @Reprevise on Nov 24, 2023 Hey @dnfield! How has this changed since `vector_graphics` is now the backend? I have this inconspicuous SVG here that is ~547kb. I used the vector_graphics_compiler to create a binary but that is still ~200kb. ![CS2 Skill Group 18](https://trackercdn.com/cdn/tracker.gg/cs2/icons/skillgroups/skillgroup18.svg) Right now, we're going to switch to using PNGs instead of an SVG for this, but I'd like to come back to it eventually. Is there any other way you think I could optimize this, especially for a scrolling list? --- Comment by @dnfield on Nov 25, 2023 > Hey @dnfield! How has this changed since `vector_graphics` is now the backend? I have this inconspicuous SVG here that is ~547kb. I used the vector_graphics_compiler to create a binary but that is still ~200kb. ![CS2 Skill Group 18](https://camo.githubusercontent.com/65e4b86f1d1a2cf02ebcdaf18917740ffd6e7ad626843f12cabab3097ccdfa31/68747470733a2f2f747261636b657263646e2e636f6d2f63646e2f747261636b65722e67672f6373322f69636f6e732f736b696c6c67726f7570732f736b696c6c67726f757031382e737667) > > Right now, we're going to switch to using PNGs instead of an SVG for this, but I'd like to come back to it eventually. Is there any other way you think I could optimize this, especially for a scrolling list? This particular SVG is very detailed and would probably be better to ship as a raster asset. --- Comment by @Reprevise on Nov 25, 2023 > This particular SVG is very detailed and would probably be better to ship as a raster asset. We have shipped this as a WEBP for the time being (the 17 other rank SVGs too), and it's definitely way more compact at around ~40kb, and Flutter doesn't seem to have a problem with these. Thanks for the input! _Thanks to you and the team for making this, we use your package a lot in production in our app!_
package,p: flutter_svg
low
Minor
2,655,929,103
flutter
[flutter_svg] Bad state: Unsupported transform: ,translate
_Imported from https://github.com/dnfield/flutter_svg/issues/405_ Original report by @liuqun1 on Aug 20, 2020 Bad state: Unsupported transform: ,translate --- Comment by @Proberts on Aug 24, 2020 Is that comma before "translate" in the SVG? I think transforms are seperated by spaces, not commas. FWIW - Translate transforms are working for me with g tags. --- Comment by @dnfield on Aug 24, 2020 Please share a full reproducing SVG.
package,p: flutter_svg
low
Minor
2,655,929,275
flutter
[flutter_svg] Layering multiple SVGs
_Imported from https://github.com/dnfield/flutter_svg/issues/408_ Original report by @Proberts on Aug 24, 2020 If I have multiple SVG images and want to combine them into a single drawable, is there an easy way to do this in flutter_svg already? I've hacked together a solution that pre-processes the SVGs as strings to transform and layer discreet svg elements as groups, but it seems like somewhere down in the data models there'd be a better way to add elements from one SVG to another. (I'm using the SVGs for google maps BitmapDescriptor so I can't use a Flutter Stack widget.)
package,p: flutter_svg
low
Minor
2,655,929,388
flutter
[flutter_svg] test for predicted svg image
_Imported from https://github.com/dnfield/flutter_svg/issues/411_ Original report by @shinriyo on Aug 27, 2020 Hello I want to Integrated test for svg image set or not. ``` final parentWidget = find.byWidget(detailReviewTableRow); final childrenFinder = find.descendant( of: parentWidget, matching: find.byType('SvgPicture'), ); expect(/* how to? */); ``` I want to check how many 'assets/hoge1.svg' and 'assets/hoge1.svg' exist ``` final svgPicture = SvgPicture.asset( 'assets/hoge1.svg', width: 100, height: 100, ); final svgPicture = SvgPicture.asset( 'assets/hoge2.svg', width: 100, height: 100, ); ``` `Image` can check by `keyName`. but, this is how?
package,p: flutter_svg
low
Minor
2,655,929,506
flutter
[flutter_svg] SVG with fill-opacity on groups not rendering correctly
_Imported from https://github.com/dnfield/flutter_svg/issues/412_ Original report by @bbedward on Sep 1, 2020 I attached an svg that the plugin is not rendering correctly, I believe it is due to fill-opacity existing on groups `<g>` elements [monkey.zip](https://github.com/dnfield/flutter_svg/files/5157330/monkey.zip) Here's what the expected output is: ![image](https://user-images.githubusercontent.com/550752/91873968-a9926c00-ec47-11ea-8f74-da71366c0051.png) This is what it looks like when rendered with flutter_svg: ![image](https://user-images.githubusercontent.com/550752/91874121-d0e93900-ec47-11ea-88bd-0c5ebd7073fc.png) I believe this is due to the fill-opacity on the groups as I said, but not entirely sure. --- Comment by @stact on Jan 1, 2021 Seems to be related to #184 --- Comment by @dnfield on Mar 29, 2022 This managed to fall off my radar. It's fixable, but I'm currently working on a successor to flutter_svg that already can correctly render this image. I am still not sure if or when I will get to this. --- Comment by @dnfield on Mar 29, 2022 The successor is at https://github.com/dnfield/vector_graphics. It is not currently ready for release.
package,p: flutter_svg
low
Minor
2,655,929,622
flutter
[flutter_svg] OnError in SvgPicture.network
_Imported from https://github.com/dnfield/flutter_svg/issues/421_ Original report by @marcoprodata on Sep 23, 2020 Dears, How to set a errorimage when the url is bloken? Thanks to advance, --- Comment by @franarolas on Mar 2, 2021 @dnfield Is there any work on that or any way to achieve that?
package,p: flutter_svg
low
Critical
2,655,929,753
flutter
[flutter_svg] SVG Path Rendering Issue
_Imported from https://github.com/dnfield/flutter_svg/issues/424_ Original report by @jameschensmith on Sep 25, 2020 First of all, thank you for this great library. I am going through the free Android course on Udemy while exercising my Flutter skills. In the first project, we are given some VectorDrawable XML files. I was able to convert them manually back to SVG, validating through the browser that the SVG is rendering as desired. <details> <summary>VectorDrawable XML</summary> ```xml <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="200dp" android:height="250dp" android:viewportWidth="800" android:viewportHeight="1000"> <path android:fillAlpha="0.5" android:fillColor="#eee" android:pathData="M740.8,635.42c-68.27,90.47 -249.77,201.76 -316,240.63a50.7,50.7 0,0 1,-49.93 0.81c-64.19,-35 -234.09,-133.88 -315.65,-242a14.69,14.69 0,0 1,-0.12 -17.49c77.58,-106.29 159.67,-258.89 341.06,-258.89 182,0 242.19,139.08 340.27,258.88A14.62,14.62 0,0 1,740.8 635.42Z" android:strokeAlpha="0.5" /> <path android:fillColor="#bdbdbd" android:pathData="M704.9,630l-294.29,191.06l0,-340.85l294.29,-191.06l0,340.85z" /> <path android:fillColor="#e0e0e0" android:pathData="M97.59,630l294.29,191.06l0,-340.85l-294.29,-191.06l0,340.85z" /> <path android:fillColor="#f5f5f5" android:pathData="M400.14,464.73l-293.19,-191.45l293.19,-156.31l295.39,156.31l-295.39,191.45z" /> <path android:fillColor="#eee" android:pathData="M106.95,273.28l-9.36,15.87l294.29,191.06l8.26,-15.48l-293.19,-191.45z" /> <path android:fillColor="#e0e0e0" android:pathData="M695.53,273.28l9.37,15.87l-294.29,191.06l-10.47,-15.48l295.39,-191.45z" /> <path android:fillColor="#eee" android:pathData="M391.88,480.21h18.73v340.85h-18.73z" /> <path android:fillColor="#f5f5f5" android:pathData="M400.14,464.73l-8.26,15.48l18.73,0l-10.47,-15.48z" /> <path android:fillColor="#78c257" android:pathData="M397.45,297.62a16.9,28.71 97.07,1 0,4.16 -33.54a16.9,28.71 97.07,1 0,-4.16 33.54z" /> <path android:fillColor="#78c257" android:pathData="M297.17,539.02a30.12,16.11 53.82,1 0,26.01 -19.02a30.12,16.11 53.82,1 0,-26.01 19.02z" /> <path android:fillColor="#78c257" android:pathData="M161.96,588.24a30.12,16.11 53.82,1 0,26.01 -19.02a30.12,16.11 53.82,1 0,-26.01 19.02z" /> <path android:fillColor="#78c257" android:pathData="M551.15,579.45a30.12,16.11 126.18,1 0,35.56 -48.62a30.12,16.11 126.18,1 0,-35.56 48.62z" /> <path android:fillColor="#78c257" android:pathData="M469.12,549.58a30.12,16.11 126.18,1 0,35.56 -48.62a30.12,16.11 126.18,1 0,-35.56 48.62z" /> <path android:fillColor="#78c257" android:pathData="M633.17,609.29a30.12,16.11 126.18,1 0,35.56 -48.62a30.12,16.11 126.18,1 0,-35.56 48.62z" /> </vector> ``` </details> <details> <summary>SVG equivalent</summary> ```svg <svg xmlns="http://www.w3.org/2000/svg" width="200" height="250" viewBox="0 0 800 1000"> <path fill-opacity="0.5" fill="#eee" d="M740.8,635.42c-68.27,90.47 -249.77,201.76 -316,240.63a50.7,50.7 0,0 1,-49.93 0.81c-64.19,-35 -234.09,-133.88 -315.65,-242a14.69,14.69 0,0 1,-0.12 -17.49c77.58,-106.29 159.67,-258.89 341.06,-258.89 182,0 242.19,139.08 340.27,258.88A14.62,14.62 0,0 1,740.8 635.42Z" stroke-opacity="0.5" /> <path fill="#bdbdbd" d="M704.9,630l-294.29,191.06l0,-340.85l294.29,-191.06l0,340.85z" /> <path fill="#e0e0e0" d="M97.59,630l294.29,191.06l0,-340.85l-294.29,-191.06l0,340.85z" /> <path fill="#f5f5f5" d="M400.14,464.73l-293.19,-191.45l293.19,-156.31l295.39,156.31l-295.39,191.45z" /> <path fill="#eee" d="M106.95,273.28l-9.36,15.87l294.29,191.06l8.26,-15.48l-293.19,-191.45z" /> <path fill="#e0e0e0" d="M695.53,273.28l9.37,15.87l-294.29,191.06l-10.47,-15.48l295.39,-191.45z" /> <path fill="#eee" d="M391.88,480.21h18.73v340.85h-18.73z" /> <path fill="#f5f5f5" d="M400.14,464.73l-8.26,15.48l18.73,0l-10.47,-15.48z" /> <path fill="#78c257" d="M397.45,297.62a16.9,28.71 97.07,1 0,4.16 -33.54a16.9,28.71 97.07,1 0,-4.16 33.54z" /> <path fill="#78c257" d="M297.17,539.02a30.12,16.11 53.82,1 0,26.01 -19.02a30.12,16.11 53.82,1 0,-26.01 19.02z" /> <path fill="#78c257" d="M161.96,588.24a30.12,16.11 53.82,1 0,26.01 -19.02a30.12,16.11 53.82,1 0,-26.01 19.02z" /> <path fill="#78c257" d="M551.15,579.45a30.12,16.11 126.18,1 0,35.56 -48.62a30.12,16.11 126.18,1 0,-35.56 48.62z" /> <path fill="#78c257" d="M469.12,549.58a30.12,16.11 126.18,1 0,35.56 -48.62a30.12,16.11 126.18,1 0,-35.56 48.62z" /> <path fill="#78c257" d="M633.17,609.29a30.12,16.11 126.18,1 0,35.56 -48.62a30.12,16.11 126.18,1 0,-35.56 48.62z" /> </svg> ``` </details> When I load the SVG asset into my code, though. The result is quite odd. It appears that the dots on the die are being duplicated. <details> <summary>View screenshot</summary> ![Screenshot_1601008375](https://user-images.githubusercontent.com/15643597/94227327-ca08bb80-febf-11ea-88d3-57f1e57391fb.png) </details> I am loading the asset using the snippet below. If I'm doing anything wrong, let me know. Thanks again! ```dart SvgPicture.asset( 'assets/dice_1.svg', width: 200, height: 250, ); ```
package,p: flutter_svg
low
Minor
2,655,929,883
flutter
[flutter_svg] Svg's Blend mode don't work when scroll is end.
_Imported from https://github.com/dnfield/flutter_svg/issues/438_ Original report by @jason-moore92 on Oct 28, 2020 I used this package in my flutter project. SingleChildScrollView( child: Column( children: [ ...... other components ..... SvgPicture.asset( "path", width: 200, height: 200, fit: BoxFit.cover, ), ...... other components ..... ], ) ) Svg file have some blend mode properties. [https://drive.google.com/file/d/1lL1sYKFUWxtLXMX1RHZMJUc-Usq_Xq7R/view](url) This is svg file [https://drive.google.com/file/d/1l5IMaaNeq2s9BK3P7joCkHiOW5WzPMgh/view?usp=sharing](url) As usual , svg is working well. But, when start scrolling and scroll is end, svg's blend mode don't work. I will attach capture video. [https://drive.google.com/file/d/1Qtk_RU9GGwQdgMN4_Oxa3TZec7sGoYOv/view](url) I will wait for good news Thanks for your time. --- Comment by @dnfield on Oct 28, 2020 The links seem to be broken. --- Comment by @dnfield on Oct 28, 2020 Also, can you please share a full reproduction including sample SVG? --- Comment by @jason-moore92 on Oct 29, 2020 Okay sir. I will share source code. --- Comment by @jason-moore92 on Oct 29, 2020 There is xd file including svg file and some screenshots https://drive.google.com/drive/u/0/folders/1tpqykNvjYHC23shN9y3TsPgVLuz3c_oh This is the test project. [svg_issue.zip](https://github.com/dnfield/flutter_svg/files/5455795/svg_issue.zip) As you can know if you check and run the project, I added the same 2 svg file. but 1th svg file is okay, but 2th svg file don't working well. --- Comment by @jason-moore92 on Oct 30, 2020 Hello sir. could you help me? --- Comment by @dnfield on Nov 10, 2020 I am not able to reproduce this bug. I strongly suspect this is a Skia related issue on a specific device. It would help to know what specific device/GPU model you're seeing this on - it should be possible to create a reduced reproduction for the Skia team to look at. --- Comment by @jason-moore92 on Nov 11, 2020 I tested samsung phone and Huawei. Huawei: CPU: Qualcomm Snapdragon 450 GPU: OpenGL --- Comment by @dnfield on Nov 12, 2020 I don't have access to those devices at the moment :\ --- Comment by @jason-moore92 on Nov 12, 2020 sorry sir. What's mean? Don't you have those device? --- Comment by @jason-moore92 on Nov 12, 2020 Or Do you have samsung phone? Samsung Galaxy A8s
package,p: flutter_svg
low
Critical
2,655,930,012
flutter
[flutter_svg] Lags even with precache
_Imported from https://github.com/dnfield/flutter_svg/issues/440_ Original report by @gwennguihal on Nov 2, 2020 Hi, First thank for this great library, very useful! But, even if I precache my svgs, I have some lags in the route transition (in release mode on iOS whatever the device used) at the first install. But if I kill the app and reopen it, it's ok, no more lags on screens already visited, like there is 2 caches ? The weight of the svg is between 38ko and 50ko. I put a breakpoint in `PictureCache` class in `putIfAbsent` method, svg are well preloaded when I push the secondScreen, I got a result. My workaround is to use PNG instead ov SVG but it increases the size of the app. --- Comment by @dnfield on Nov 2, 2020 It would probably help to have a full reproduction. There are some issues on iOS with Flutter at this point related to shader cache warmup, unrelated to SVG, which could be causing this. --- Comment by @gwennguihal on Nov 2, 2020 I will try to make a sample app to reproduce. --- Comment by @gwennguihal on Nov 3, 2020 Hi Dan, there is the sample app: https://github.com/gwennguihal/flutter_svg_demo Thanks. --- Comment by @chris-rutkowski on Nov 7, 2020 Hey, perhaps I will join this issue, with my app 📲 https://well-spoken.app I experience a similar problem - very slow loading of the attached SVG. ``` <?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" version="1.1" width="512" height="512" x="0" y="0" viewBox="0 0 503.775 503.775" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g> <circle xmlns="http://www.w3.org/2000/svg" style="" cx="251.888" cy="251.888" r="251.888" fill="#51489a" data-original="#2d76b2" class=""/> <circle xmlns="http://www.w3.org/2000/svg" style="" cx="251.888" cy="251.888" r="180.835" fill="#6a61b4" data-original="#4279bd" class=""/> <path xmlns="http://www.w3.org/2000/svg" id="SVGCleanerId_0" style="" d="M135.745,307.952H39.199c-13.371,0-24.209,10.838-24.209,24.209v5.498 c24.642,68.046,77.76,122.448,144.964,148.807V332.16C159.954,318.79,149.115,307.952,135.745,307.952z" fill="#d9f9fc" data-original="#d9f9fc" class=""/> <g xmlns="http://www.w3.org/2000/svg"> <path id="SVGCleanerId_0_1_" style="" d="M135.745,307.952H39.199c-13.371,0-24.209,10.838-24.209,24.209v5.498 c24.642,68.046,77.76,122.448,144.964,148.807V332.16C159.954,318.79,149.115,307.952,135.745,307.952z" fill="#d9f9fc" data-original="#d9f9fc" class=""/> </g> <path xmlns="http://www.w3.org/2000/svg" style="" d="M135.745,307.952h-20.562c13.371,0,24.209,10.838,24.209,24.209v145.131 c6.693,3.346,13.545,6.423,20.562,9.174V332.16C159.954,318.79,149.115,307.952,135.745,307.952z" fill="#ace0f3" data-original="#ace0f3" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M81.733,307.952h8.524c2.379,0,4.325-1.946,4.325-4.325v-55.748c0-2.379-1.946-4.325-4.325-4.325 h-8.524c-2.379,0-4.325,1.946-4.325,4.325v55.748C77.408,306.005,79.354,307.952,81.733,307.952z" fill="#7a8d9d" data-original="#7a8d9d"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M88.949,307.952h2.471c1.682,0,3.059-1.377,3.059-3.059v-58.282c0-1.682-1.377-3.059-3.059-3.059 h-2.471c-1.682,0-3.059,1.377-3.059,3.059v58.282C85.891,306.575,87.266,307.952,88.949,307.952z" fill="#57646e" data-original="#57646e"/> <polygon xmlns="http://www.w3.org/2000/svg" style="" points="57.696,307.952 113.946,307.952 94.477,299.103 77.303,299.103 " fill="#8a9ca8" data-original="#8a9ca8"/> <polygon xmlns="http://www.w3.org/2000/svg" style="" points="94.477,299.103 113.946,307.952 105.181,307.952 85.713,299.103 " fill="#6f7e87" data-original="#6f7e87"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M85.891,274.668L85.891,274.668c9.311,0,15.973-7.667,16.929-16.929 c0.394-3.818,3.135-15.03,3.135-15.03c0-1.045-0.854-1.899-1.899-1.899H67.726c-1.045,0-1.899,0.854-1.899,1.899 c0,0,2.741,11.212,3.135,15.03C69.917,267.002,76.58,274.668,85.891,274.668z" fill="#f99d28" data-original="#f99d28"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M77.462,301.054h17.014c1.754,0,3.189-1.435,3.189-3.189l0,0c0-1.754-1.435-3.189-3.189-3.189H77.462 c-1.754,0-3.189,1.435-3.189,3.189l0,0C74.273,299.62,75.708,301.054,77.462,301.054z" fill="#96a8b2" data-original="#96a8b2"/> <g xmlns="http://www.w3.org/2000/svg"> <path style="" d="M93.283,297.866c0-1.754-1.435-3.189-3.189-3.189h4.383c1.754,0,3.189,1.435,3.189,3.189 c0,1.754-1.435,3.189-3.189,3.189h-4.383C91.847,301.054,93.283,299.62,93.283,297.866z" fill="#8a9ca8" data-original="#8a9ca8"/> <path style="" d="M86.048,274.668L86.048,274.668c9.311,0,15.973-7.667,16.929-16.929 c0.394-3.818,3.135-15.03,3.135-15.03c0-1.045-0.854-1.899-1.899-1.899H67.883c-1.045,0-1.899,0.854-1.899,1.899 c0,0,2.741,11.212,3.135,15.03C70.074,267.002,76.736,274.668,86.048,274.668z" fill="#8a9ca8" data-original="#8a9ca8"/> </g> <path xmlns="http://www.w3.org/2000/svg" style="" d="M94.851,257.741c0.394-3.818,3.135-15.03,3.135-15.03c0-1.045-0.854-1.899-1.899-1.899h7.968 c1.045,0,1.899,0.854,1.899,1.899c0,0-2.741,11.212-3.135,15.03c-0.955,9.261-7.617,16.929-16.929,16.929l0,0 c-1.391,0-2.721-0.175-3.984-0.497C89.095,272.339,94.038,265.618,94.851,257.741z" fill="#707d84" data-original="#707d84"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M56.545,317.84h58.552c3.005,0,5.464-2.459,5.464-5.464l0,0c0-3.005-2.459-5.464-5.464-5.464H56.545 c-3.005,0-5.464,2.459-5.464,5.464l0,0C51.08,315.381,53.539,317.84,56.545,317.84z" fill="#96a8b2" data-original="#96a8b2"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M107.016,312.376L107.016,312.376c0-3.005-2.459-5.464-5.464-5.464h13.545 c3.005,0,5.464,2.459,5.464,5.464l0,0c0,3.005-2.459,5.464-5.464,5.464h-13.545C104.557,317.84,107.016,315.381,107.016,312.376z" fill="#8a9ca8" data-original="#8a9ca8"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M99.055,177.239v53.511c0,4.205,3.44,7.644,7.644,7.644h25.211c19.77,0,35.945-16.175,35.945-35.945 v-25.211c0-4.205-3.44-7.644-7.644-7.644H106.7C102.495,169.595,99.055,173.035,99.055,177.239z M106.7,183.185 c0-3.27,2.675-5.946,5.946-5.946h41.62c3.27,0,5.946,2.675,5.946,5.946v19.609c0,15.376-12.581,27.956-27.956,27.956h-19.609 c-3.27,0-5.946-2.675-5.946-5.946C106.7,224.805,106.7,183.185,106.7,183.185z" fill="#8ea3b2" data-original="#8ea3b2"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M64.942,169.595H11.431c-4.204,0-7.644,3.44-7.644,7.644v25.211c0,19.77,16.175,35.945,35.945,35.945 h25.211c4.205,0,7.644-3.44,7.644-7.644V177.24C72.587,173.035,69.147,169.595,64.942,169.595z M64.942,224.805 c0,3.27-2.675,5.946-5.946,5.946H39.387c-15.376,0-27.956-12.58-27.956-27.956v-19.609c0-3.27,2.675-5.946,5.946-5.946h41.62 c3.27,0,5.946,2.675,5.946,5.946V224.805z" fill="#ccdde7" data-original="#ccdde7"/> <g xmlns="http://www.w3.org/2000/svg"> <circle style="" cx="84.377" cy="199.598" r="25.38" fill="#fcb216" data-original="#fcb216"/> <circle style="" cx="84.377" cy="199.598" r="25.38" fill="#fcb216" data-original="#fcb216"/> </g> <path xmlns="http://www.w3.org/2000/svg" style="" d="M83.351,265.507h5.444c23.848,0,43.801-18.101,46.116-41.836l6.765-69.336 c0.5-5.119-3.523-9.553-8.667-9.553H39.137c-5.144,0-9.167,4.434-8.667,9.553l6.765,69.336 C39.55,247.405,59.504,265.507,83.351,265.507z" fill="#abbac3" data-original="#abbac3" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M118.743,220.351c0,0,4.732-75.328,4.738-75.57h9.296c5.144,0,9.167,4.434,8.667,9.553l-6.765,69.336 c-2.315,23.735-22.269,41.836-46.116,41.836h-5.444c-1.808,0-3.594-0.106-5.351-0.308 C99.285,262.627,116.596,244.105,118.743,220.351z" fill="#8ea3b2" data-original="#8ea3b2"/> <g xmlns="http://www.w3.org/2000/svg"> <path style="" d="M37.096,218.184l-1.338,5.063c-0.104,0.393-0.41,0.699-0.802,0.802l-5.063,1.338 c-1.12,0.296-1.12,1.885,0,2.181l5.063,1.338c0.393,0.104,0.699,0.41,0.802,0.802l1.338,5.063c0.296,1.12,1.885,1.12,2.181,0 l1.338-5.063c0.104-0.393,0.41-0.699,0.802-0.802l5.063-1.338c1.12-0.296,1.12-1.885,0-2.181l-5.063-1.338 c-0.393-0.104-0.699-0.41-0.802-0.802l-1.338-5.063C38.981,217.064,37.391,217.064,37.096,218.184z" fill="#ffffff" data-original="#ffffff"/> <path style="" d="M137.201,182.97l-0.921,3.487c-0.071,0.27-0.283,0.481-0.553,0.553l-3.487,0.921 c-0.771,0.204-0.771,1.299,0,1.502l3.487,0.921c0.27,0.071,0.481,0.283,0.553,0.553l0.921,3.487c0.204,0.771,1.299,0.771,1.502,0 l0.921-3.487c0.071-0.27,0.283-0.481,0.553-0.553l3.487-0.921c0.771-0.204,0.771-1.299,0-1.502l-3.487-0.921 c-0.27-0.071-0.481-0.283-0.553-0.553l-0.921-3.487C138.499,182.199,137.404,182.199,137.201,182.97z" fill="#ffffff" data-original="#ffffff"/> </g> <path xmlns="http://www.w3.org/2000/svg" style="" d="M300.325,255.518h-96.546c-13.371,0-24.209,10.838-24.209,24.209V493.22 c22.908,6.854,47.179,10.555,72.317,10.555c25.259,0,49.641-3.735,72.646-10.653V279.727 C324.534,266.356,313.696,255.518,300.325,255.518z" fill="#d9f9fc" data-original="#d9f9fc" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M300.325,255.518h-20.562c13.371,0,24.209,12.042,24.209,26.896V498.36 c6.963-1.466,13.823-3.212,20.562-5.238V279.727C324.534,266.356,313.696,255.518,300.325,255.518z" fill="#ace0f3" data-original="#ace0f3" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M247.8,256.546h8.524c2.379,0,4.325-1.946,4.325-4.325v-55.748c0-2.379-1.946-4.325-4.325-4.325 H247.8c-2.379,0-4.325,1.946-4.325,4.325v55.748C243.475,254.6,245.421,256.546,247.8,256.546z" fill="#f78f1e" data-original="#f78f1e"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M255.016,256.546h2.471c1.682,0,3.059-1.377,3.059-3.059v-58.282c0-1.682-1.377-3.059-3.059-3.059 h-2.471c-1.682,0-3.059,1.377-3.059,3.059v58.282C251.957,255.169,253.333,256.546,255.016,256.546z" fill="#ed7e11" data-original="#ed7e11"/> <polygon xmlns="http://www.w3.org/2000/svg" style="" points="223.762,256.546 280.013,256.546 260.544,247.697 243.37,247.697 " fill="#fcb216" data-original="#fcb216"/> <polygon xmlns="http://www.w3.org/2000/svg" style="" points="260.544,247.697 280.013,256.546 271.248,256.546 251.78,247.697 " fill="#f2a216" data-original="#f2a216"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M251.957,223.263L251.957,223.263c9.311,0,15.973-7.667,16.929-16.929 c0.394-3.818,3.135-15.03,3.135-15.03c0-1.045-0.854-1.899-1.899-1.899h-36.329c-1.045,0-1.899,0.854-1.899,1.899 c0,0,2.741,11.212,3.135,15.03C235.984,215.596,242.647,223.263,251.957,223.263z" fill="#f99d28" data-original="#f99d28"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M243.529,249.648h17.014c1.754,0,3.189-1.435,3.189-3.189l0,0c0-1.754-1.435-3.189-3.189-3.189 h-17.014c-1.754,0-3.189,1.435-3.189,3.189l0,0C240.34,248.214,241.775,249.648,243.529,249.648z" fill="#febf3f" data-original="#febf3f"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M259.35,246.46c0-1.754-1.435-3.189-3.189-3.189h4.383c1.754,0,3.189,1.435,3.189,3.189 s-1.435,3.189-3.189,3.189h-4.383C257.914,249.648,259.35,248.214,259.35,246.46z" fill="#f9b438" data-original="#f9b438"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M252.115,223.263L252.115,223.263c9.311,0,15.973-7.667,16.929-16.929 c0.394-3.818,3.135-15.03,3.135-15.03c0-1.045-0.854-1.899-1.899-1.899h-36.328c-1.045,0-1.899,0.854-1.899,1.899 c0,0,2.741,11.212,3.135,15.03C236.141,215.596,242.803,223.263,252.115,223.263z" fill="#f99d28" data-original="#f99d28"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M260.917,206.335c0.394-3.818,3.135-15.03,3.135-15.03c0-1.045-0.854-1.899-1.899-1.899h7.968 c1.045,0,1.899,0.854,1.899,1.899c0,0-2.741,11.212-3.135,15.03c-0.955,9.261-7.617,16.929-16.929,16.929l0,0 c-1.391,0-2.721-0.175-3.984-0.497C255.162,220.933,260.105,214.212,260.917,206.335z" fill="#f28a19" data-original="#f28a19"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M222.612,266.434h58.552c3.005,0,5.464-2.459,5.464-5.464l0,0c0-3.005-2.459-5.464-5.464-5.464 h-58.552c-3.005,0-5.464,2.459-5.464,5.464l0,0C217.147,263.975,219.606,266.434,222.612,266.434z" fill="#febf3f" data-original="#febf3f"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M273.083,260.97L273.083,260.97c0-3.005-2.459-5.464-5.464-5.464h13.545 c3.005,0,5.464,2.459,5.464,5.464l0,0c0,3.005-2.459,5.464-5.464,5.464h-13.546C270.624,266.434,273.083,263.975,273.083,260.97z" fill="#f9b438" data-original="#f9b438"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M265.121,125.834v53.511c0,4.205,3.44,7.644,7.644,7.644h25.211c19.77,0,35.945-16.175,35.945-35.945 v-25.211c0-4.205-3.44-7.644-7.644-7.644h-53.511C268.561,118.19,265.121,121.63,265.121,125.834z M272.766,131.779 c0-3.27,2.675-5.946,5.946-5.946h41.62c3.27,0,5.946,2.675,5.946,5.946v19.609c0,15.376-12.581,27.956-27.956,27.956h-19.609 c-3.27,0-5.946-2.675-5.946-5.946V131.779z" fill="#f99d28" data-original="#f99d28"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M231.009,118.19h-53.511c-4.204,0-7.644,3.44-7.644,7.644v25.211 c0,19.77,16.175,35.945,35.945,35.945h25.211c4.205,0,7.644-3.44,7.644-7.644v-53.511C238.654,121.63,235.214,118.19,231.009,118.19 z M231.009,173.399c0,3.27-2.675,5.946-5.946,5.946h-19.609c-15.376,0-27.956-12.58-27.956-27.956v-19.609 c0-3.27,2.675-5.946,5.946-5.946h41.62c3.27,0,5.946,2.675,5.946,5.946V173.399z" fill="#ffce61" data-original="#ffce61" class=""/> <g xmlns="http://www.w3.org/2000/svg"> <circle style="" cx="250.438" cy="148.192" r="25.38" fill="#fcb216" data-original="#fcb216"/> <circle style="" cx="250.438" cy="148.192" r="25.38" fill="#fcb216" data-original="#fcb216"/> <path style="" d="M249.418,214.101h5.444c23.848,0,43.801-18.101,46.116-41.836l6.765-69.336 c0.5-5.119-3.523-9.553-8.667-9.553h-93.872c-5.144,0-9.167,4.434-8.667,9.553l6.765,69.336 C205.617,195.999,225.571,214.101,249.418,214.101z" fill="#fcb216" data-original="#fcb216"/> </g> <path xmlns="http://www.w3.org/2000/svg" style="" d="M284.81,168.946c0,0,4.732-75.328,4.738-75.57h9.296c5.144,0,9.167,4.434,8.667,9.553l-6.765,69.336 c-2.315,23.735-22.269,41.836-46.116,41.836h-5.444c-1.808,0-3.594-0.106-5.352-0.308 C265.352,211.222,282.663,192.699,284.81,168.946z" fill="#f9a40d" data-original="#f9a40d"/> <g xmlns="http://www.w3.org/2000/svg"> <path style="" d="M214.385,100.961l-1.338,5.063c-0.104,0.393-0.41,0.699-0.802,0.802l-5.063,1.338 c-1.12,0.296-1.12,1.885,0,2.181l5.063,1.338c0.393,0.104,0.699,0.41,0.802,0.802l1.338,5.063c0.296,1.12,1.885,1.12,2.181,0 l1.338-5.063c0.104-0.393,0.41-0.699,0.802-0.802l5.063-1.338c1.12-0.296,1.12-1.885,0-2.181l-5.063-1.338 c-0.393-0.104-0.699-0.41-0.802-0.802l-1.338-5.063C216.271,99.841,214.681,99.841,214.385,100.961z" fill="#ffffff" data-original="#ffffff"/> <path style="" d="M290.685,189.271l-0.921,3.487c-0.071,0.27-0.283,0.481-0.553,0.553l-3.487,0.921 c-0.771,0.204-0.771,1.299,0,1.502l3.487,0.921c0.27,0.071,0.481,0.283,0.553,0.553l0.921,3.487c0.204,0.771,1.298,0.771,1.502,0 l0.921-3.487c0.071-0.27,0.283-0.481,0.553-0.553l3.487-0.921c0.771-0.204,0.771-1.299,0-1.502l-3.487-0.921 c-0.27-0.071-0.481-0.283-0.553-0.553l-0.921-3.487C291.984,188.5,290.889,188.5,290.685,189.271z" fill="#ffffff" data-original="#ffffff"/> </g> <path xmlns="http://www.w3.org/2000/svg" style="" d="M488.714,337.859c-4.375-6.268-11.637-10.374-19.861-10.374h-96.546 c-13.371,0-24.209,10.838-24.209,24.209V484.73C413.209,457.797,464.568,404.361,488.714,337.859z" fill="#d9f9fc" data-original="#d9f9fc" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M416.786,328.514h8.524c2.379,0,4.325-1.946,4.325-4.325V268.44c0-2.379-1.946-4.325-4.325-4.325 h-8.524c-2.379,0-4.325,1.946-4.325,4.325v55.748C412.461,326.568,414.407,328.514,416.786,328.514z" fill="#e27664" data-original="#e27664"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M424.002,328.514h2.471c1.682,0,3.059-1.377,3.059-3.059v-58.282c0-1.682-1.377-3.059-3.059-3.059 h-2.471c-1.682,0-3.059,1.377-3.059,3.059v58.282C420.944,327.137,422.32,328.514,424.002,328.514z" fill="#ce6b55" data-original="#ce6b55"/> <polygon xmlns="http://www.w3.org/2000/svg" style="" points="392.749,328.514 448.999,328.514 429.531,319.665 412.356,319.665 " fill="#e89477" data-original="#e89477" class=""/> <polygon xmlns="http://www.w3.org/2000/svg" style="" points="429.531,319.665 448.999,328.514 440.235,328.514 420.766,319.665 " fill="#db7f6a" data-original="#db7f6a" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M420.944,295.231L420.944,295.231c9.311,0,15.973-7.667,16.929-16.929 c0.394-3.818,3.135-15.03,3.135-15.03c0-1.045-0.854-1.899-1.899-1.899h-36.328c-1.045,0-1.899,0.854-1.899,1.899 c0,0,2.741,11.212,3.135,15.03C404.97,287.564,411.634,295.231,420.944,295.231z" fill="#f99d28" data-original="#f99d28"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M412.516,321.616h17.014c1.754,0,3.189-1.435,3.189-3.189l0,0c0-1.754-1.435-3.189-3.189-3.189 h-17.014c-1.754,0-3.189,1.435-3.189,3.189l0,0C409.327,320.182,410.762,321.616,412.516,321.616z" fill="#ffaf99" data-original="#ffaf99"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M428.336,318.428c0-1.754-1.435-3.189-3.189-3.189h4.383c1.754,0,3.189,1.435,3.189,3.189 c0,1.754-1.435,3.189-3.189,3.189h-4.383C426.901,321.616,428.336,320.182,428.336,318.428z" fill="#e89477" data-original="#e89477" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M421.1,295.231L421.1,295.231c9.311,0,15.973-7.667,16.929-16.929 c0.394-3.818,3.135-15.03,3.135-15.03c0-1.045-0.854-1.899-1.899-1.899h-36.328c-1.045,0-1.899,0.854-1.899,1.899 c0,0,2.741,11.212,3.135,15.03C405.128,287.564,411.79,295.231,421.1,295.231z" fill="#e2866d" data-original="#e2866d"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M429.904,278.303c0.394-3.818,3.135-15.03,3.135-15.03c0-1.045-0.854-1.899-1.899-1.899h7.968 c1.045,0,1.899,0.854,1.899,1.899c0,0-2.741,11.212-3.135,15.03c-0.955,9.261-7.617,16.929-16.929,16.929l0,0 c-1.391,0-2.721-0.175-3.984-0.497C424.148,292.901,429.092,286.18,429.904,278.303z" fill="#d37c62" data-original="#d37c62"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M391.598,338.402h58.552c3.005,0,5.464-2.459,5.464-5.464l0,0c0-3.005-2.459-5.464-5.464-5.464 h-58.552c-3.005,0-5.464,2.459-5.464,5.464l0,0C386.133,335.943,388.593,338.402,391.598,338.402z" fill="#ffaf99" data-original="#ffaf99"/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M442.07,332.938L442.07,332.938c0-3.005-2.459-5.464-5.464-5.464h13.545 c3.005,0,5.464,2.459,5.464,5.464l0,0c0,3.005-2.459,5.464-5.464,5.464h-13.545C439.611,338.402,442.07,335.943,442.07,332.938z" fill="#e89477" data-original="#e89477" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M434.108,197.802v53.511c0,4.205,3.44,7.644,7.644,7.644h25.211c19.77,0,35.945-16.175,35.945-35.945 v-25.211c0-4.205-3.44-7.644-7.644-7.644h-53.511C437.548,190.158,434.108,193.598,434.108,197.802z M441.753,203.747 c0-3.27,2.675-5.946,5.946-5.946h41.62c3.27,0,5.946,2.675,5.946,5.946v19.609c0,15.376-12.581,27.956-27.956,27.956h-19.609 c-3.27,0-5.946-2.675-5.946-5.946V203.747z" fill="#db7f6a" data-original="#db7f6a" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M399.995,190.158h-53.511c-4.204,0-7.644,3.44-7.644,7.644v25.211 c0,19.77,16.175,35.945,35.945,35.945h25.211c4.205,0,7.644-3.44,7.644-7.644v-53.511C407.64,193.598,404.2,190.158,399.995,190.158 z M399.995,245.367c0,3.27-2.675,5.946-5.946,5.946h-19.609c-15.376,0-27.956-12.58-27.956-27.956v-19.609 c0-3.27,2.675-5.946,5.946-5.946h41.62c3.27,0,5.946,2.675,5.946,5.946V245.367z" fill="#e5a189" data-original="#e5a189"/> <g xmlns="http://www.w3.org/2000/svg"> <circle style="" cx="419.429" cy="220.16" r="25.38" fill="#fcb216" data-original="#fcb216"/> <circle style="" cx="419.429" cy="220.16" r="25.38" fill="#fcb216" data-original="#fcb216"/> </g> <path xmlns="http://www.w3.org/2000/svg" style="" d="M418.405,286.069h5.444c23.848,0,43.801-18.101,46.116-41.836l6.765-69.336 c0.5-5.119-3.523-9.553-8.667-9.553h-93.872c-5.144,0-9.167,4.434-8.667,9.553l6.765,69.336 C374.604,267.967,394.558,286.069,418.405,286.069z" fill="#e89477" data-original="#e89477" class=""/> <path xmlns="http://www.w3.org/2000/svg" style="" d="M453.796,240.913c0,0,4.732-75.328,4.738-75.57h9.296c5.144,0,9.167,4.434,8.667,9.553l-6.765,69.336 c-2.315,23.735-22.269,41.836-46.116,41.836h-5.444c-1.808,0-3.594-0.106-5.352-0.308 C434.338,283.189,451.65,264.667,453.796,240.913z" fill="#db7f6a" data-original="#db7f6a" class=""/> <g xmlns="http://www.w3.org/2000/svg"> <path style="" d="M368.795,198.041l-1.338,5.063c-0.104,0.393-0.41,0.699-0.802,0.802l-5.063,1.338 c-1.12,0.296-1.12,1.885,0,2.181l5.063,1.338c0.393,0.104,0.699,0.41,0.802,0.802l1.338,5.063c0.296,1.12,1.885,1.12,2.181,0 l1.338-5.063c0.104-0.393,0.41-0.699,0.802-0.802l5.063-1.338c1.12-0.296,1.12-1.885,0-2.181l-5.063-1.338 c-0.393-0.104-0.699-0.41-0.802-0.802l-1.338-5.063C370.681,196.922,369.091,196.922,368.795,198.041z" fill="#ffffff" data-original="#ffffff"/> <path style="" d="M467.757,223.842l-0.921,3.487c-0.071,0.27-0.283,0.481-0.553,0.553l-3.487,0.921 c-0.771,0.204-0.771,1.299,0,1.502l3.487,0.921c0.27,0.071,0.481,0.283,0.553,0.553l0.921,3.487c0.204,0.771,1.298,0.771,1.502,0 l0.921-3.487c0.071-0.27,0.283-0.481,0.553-0.553l3.487-0.921c0.771-0.204,0.771-1.299,0-1.502l-3.487-0.921 c-0.27-0.071-0.481-0.283-0.553-0.553l-0.921-3.487C469.056,223.071,467.961,223.071,467.757,223.842z" fill="#ffffff" data-original="#ffffff"/> </g> <path xmlns="http://www.w3.org/2000/svg" style="" d="M488.678,337.954c-3.647-5.285-9.339-9.047-15.935-10.145c-0.182-0.03-0.364-0.061-0.548-0.085 c-0.193-0.028-0.387-0.05-0.582-0.074c-0.381-0.043-0.765-0.082-1.151-0.108c-0.037-0.003-0.074-0.006-0.111-0.008 c-0.496-0.03-0.995-0.046-1.499-0.046h-20.176c13.139,0.266,23.71,10.994,23.71,24.197v22.049 C478.708,362.318,484.167,350.364,488.678,337.954z" fill="#ace0f3" data-original="#ace0f3" class=""/> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> <g xmlns="http://www.w3.org/2000/svg"> </g> </g></svg> ``` --- Comment by @KuoyHuot on Nov 10, 2020 I also experience some lags in the route transition animation. The screen I navigate to only has 6 SVGS (picture cache in dart's main method) and the size of the SVG is only about 800 bytes to 1kg. --- Comment by @naamapps on Nov 10, 2020 I have this problem as well. My svgs are precached in the main method. I have a list of svgs in a page. When navigating to that page for the first time in the app lifetime it lags, but if I transition to that page again it works smoothly. --- Comment by @dnfield on Nov 10, 2020 Is this lag only happening on iOS, or Android/desktop/web as well? --- Comment by @dnfield on Nov 10, 2020 If it's only happening on iOS, I'm almost certain this bug would be resolved by flutter/flutter#60267 --- Comment by @dnfield on Nov 10, 2020 (particularly if you see this lag go away when using a version of Flutter before we landed Metal support on iOS) --- Comment by @naamapps on Nov 11, 2020 @dnfield I'm on Android --- Comment by @dnfield on Nov 11, 2020 @naamapps - does the lag happen on a second run of the same application? The very first time may involve compiling some new shader previously not used, which can cause jank, but should only cause it once. I'd expect precaching the SVG to end up working around this but it's possible it's not. --- Comment by @naamapps on Nov 11, 2020 Hey @dnfield, It's every run. But only once for every run. All other times in a run, it is smooth. Like I said, I preloaded all my svgs in the main method and put a RepaintBoundry on the list of the svgs. The scrolling of the list is smooth, but the transition to the page of the list is janky. --- Comment by @dnfield on Nov 12, 2020 Can someone share the timeline output during the jank period(s)? --- Comment by @gwennguihal on Nov 13, 2020 Hi @dnfield, Here the timeline (profile mode on an iphone 8) associated with https://github.com/gwennguihal/flutter_svg_demo.git. [dart_devtools_2020_11_13-1605265674420000.json.zip](https://github.com/dnfield/flutter_svg/files/5536396/dart_devtools_2020_11_13-1605265674420000.json.zip) Thanks --- Comment by @naamapps on Dec 31, 2020 Hey @dnfield, Any updates on this? --- Comment by @dnfield on Jan 3, 2021 That trace looks strange to me. I'll try to take a look at this demo a bit more. --- Comment by @dnfield on Jan 3, 2021 I will say that the camera SVG in particular in the sample project looks very complicated. I would not expect rendering that to be very fast. Is the project still problematic without it? --- Comment by @Tryliom on Mar 23, 2021 I have the same lag but only when I change the orientation on my android device to landscape with only 2 svg (In landscape mode, we see only 1 svg at time) --- Comment by @Tarikul-Tuhin on Mar 17, 2024 Follow these steps to prevent from lags: Step 1: Add dependencies dependencies: vector_graphics: ^latest_version vector_graphics_compiler: ^latest_version Step 2: Generate .vec file from your .svg file. Suppose, your svg file is in the assets folder and the filename is foo.svg. Now, Run this command in your terminal `dart run vector_graphics_compiler -i assets/foo.svg -o assets/foo.svg.vec` Note: If your file is successfully generated, then you will notice a file in the assets folder named '**assets/foo.svg.vec**' Step 3: Add VectorGraphic widget Inside your widget tree and import above packages. ``` VectorGraphic( loader: AssetBytesLoader('assets/foo.svg.vec'), ) ``` Done. Let me know if it works. --- Comment by @jartos on Mar 26, 2024 I had no problems on Android devices with SVG-images. But on iOS with iPhone 11 real device I had jank in a ListView widget using SVG-images. I did as **Tarikul-Tuhin** instructed. Performance improved. > Done. Let me know if it works. It works. Thanks!
package,p: flutter_svg
low
Critical
2,655,930,126
flutter
[flutter_svg] Add callback to listen when load error
_Imported from https://github.com/dnfield/flutter_svg/issues/448_ Original report by @tbm98 on Nov 17, 2020 I want to know when it can't show image and throw error --- Comment by @WieFel on Dec 15, 2020 +1
package,p: flutter_svg
low
Critical
2,655,930,244
flutter
[flutter_svg] No support for preserveAspectRatio parameter
_Imported from https://github.com/dnfield/flutter_svg/issues/451_ Original report by @Since55 on Nov 19, 2020 This parameter is not supported or doesn't work correctly.
package,p: flutter_svg
low
Minor
2,655,930,383
flutter
[flutter_svg] Format Exception when encountering percentage instead of double
_Imported from https://github.com/dnfield/flutter_svg/issues/458_ Original report by @loganrussell48 on Nov 30, 2020 I am retrieving the SVG data from a 3rd party, and it contains the following text that is causing an issue: `<image clip-path="url(#clip)" height="62.0%" width="62.0%" .... >` This causes my app to be unable to render important sections that are provided by the 3rd party SVGs. A fix or update for this would be greatly appreciated. --- Comment by @JaffaKetchup on Oct 21, 2021 Same issue here! --- Comment by @kamxy on Aug 23, 2023 Any update?
package,p: flutter_svg
low
Minor
2,655,938,315
svelte
docs: deep reactivity & proxified objects
### Describe the bug One gotcha with deep reactivity is to make sure to grab the proxified object to work with inside closures to trigger the reactivity. Maybe just a note in the docs about this can help? Or the examples below ### Reproduction https://svelte.dev/playground/facd17ade79c4b56975cca4a9de21451?version=5.1.16 ### Logs _No response_ ### System Info ```shell none ``` ### Severity annoyance
documentation
low
Critical
2,655,940,460
flutter
[flutter_svg] InkSCape MeshGradient implementation Request
_Imported from https://github.com/dnfield/flutter_svg/issues/476_ Original report by @taerilan on Jan 18, 2021 Hello there, I would like to make request for implementation of InkScape meshGradient in your package, I believe this would be beneficial for your whole project as InkScape meshGradient gives SVG images depth, 3d illusion that brings whole SVG image to life in 3d like way. Ive included in code below simple SVG code with meshGradient so you can check it out, couldn't upload SVG image directly, Ive also uploaded PNG image of a piano key created in InkScape with meshGradient, so you could see how it looks like. Thought that issue with meshGradient in your package is similar to linearGradient issue, though after managing to solve linearGradient issue (when saving InkScape project as Optimized SVG, it works in your package as charm), meshGradient was still not working. In your package I've found references for linearGradient and radialGradient, though not meshGradient, so it seems meshGradient is not implemented at all? Hope you will consider adding it, as it would add quality and aesthetic beauty to my and other peoples projects. Thank ![bku](https://user-images.githubusercontent.com/15383948/104908801-ef1ac000-59c1-11eb-9ba5-104144ba64de.png) ![bkd](https://user-images.githubusercontent.com/15383948/104912450-3bb4ca00-59c7-11eb-8301-36721542f85b.png) ![bku](https://user-images.githubusercontent.com/15383948/104912512-4ff8c700-59c7-11eb-9833-de95c5275cb4.png) ```xml <?xml version="1.0" encoding="UTF-8"?> <svg width="76.729mm" height="124.35mm" version="1.1" viewBox="0 0 76.729 124.35" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <defs> <meshgradient id="meshgradient1846" x="55.184521" y="39.6875" gradientUnits="userSpaceOnUse"> <meshrow> <meshpatch> <stop stop-color="#fff" path="c 25.5764,0 51.1528,0 76.7292,0"/> <stop path="c 0,41.4514 0,82.9028 0,124.354"/> <stop stop-color="#fff" path="c -25.5764,0 -51.1528,0 -76.7292,0"/> <stop path="c 0,-41.4514 0,-82.9028 0,-124.354"/> </meshpatch> </meshrow> </meshgradient> </defs> <metadata> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> <dc:title/> </cc:Work> </rdf:RDF> </metadata> <g transform="translate(-55.185 -39.688)"> <rect x="55.185" y="39.688" width="76.729" height="124.35" fill="url(#meshgradient1846)"/> </g> <script id="mesh_polyfill" type="text/javascript">!function(){const t="http://www.w3.org/2000/svg",e="http://www.w3.org/1999/xlink",s="http://www.w3.org/1999/xhtml",r=2;if(document.createElementNS(t,"meshgradient").x)return;const n=(t,e,s,r)=&gt;{let n=new x(.5*(e.x+s.x),.5*(e.y+s.y)),o=new x(.5*(t.x+e.x),.5*(t.y+e.y)),i=new x(.5*(s.x+r.x),.5*(s.y+r.y)),a=new x(.5*(n.x+o.x),.5*(n.y+o.y)),h=new x(.5*(n.x+i.x),.5*(n.y+i.y)),l=new x(.5*(a.x+h.x),.5*(a.y+h.y));return[[t,o,a,l],[l,h,i,r]]},o=t=&gt;{let e=t[0].distSquared(t[1]),s=t[2].distSquared(t[3]),r=.25*t[0].distSquared(t[2]),n=.25*t[1].distSquared(t[3]),o=e&gt;s?e:s,i=r&gt;n?r:n;return 18*(o&gt;i?o:i)},i=(t,e)=&gt;Math.sqrt(t.distSquared(e)),a=(t,e)=&gt;t.scale(2/3).add(e.scale(1/3)),h=t=&gt;{let e,s,r,n,o,i,a,h=new g;return t.match(/(\w+\(\s*[^)]+\))+/g).forEach(t=&gt;{let l=t.match(/[\w.-]+/g),d=l.shift();switch(d){case"translate":2===l.length?e=new g(1,0,0,1,l[0],l[1]):(console.error("mesh.js: translate does not have 2 arguments!"),e=new g(1,0,0,1,0,0)),h=h.append(e);break;case"scale":1===l.length?s=new g(l[0],0,0,l[0],0,0):2===l.length?s=new g(l[0],0,0,l[1],0,0):(console.error("mesh.js: scale does not have 1 or 2 arguments!"),s=new g(1,0,0,1,0,0)),h=h.append(s);break;case"rotate":if(3===l.length&amp;&amp;(e=new g(1,0,0,1,l[1],l[2]),h=h.append(e)),l[0]){r=l[0]*Math.PI/180;let t=Math.cos(r),e=Math.sin(r);Math.abs(t)&lt;1e-16&amp;&amp;(t=0),Math.abs(e)&lt;1e-16&amp;&amp;(e=0),a=new g(t,e,-e,t,0,0),h=h.append(a)}else console.error("math.js: No argument to rotate transform!");3===l.length&amp;&amp;(e=new g(1,0,0,1,-l[1],-l[2]),h=h.append(e));break;case"skewX":l[0]?(r=l[0]*Math.PI/180,n=Math.tan(r),o=new g(1,0,n,1,0,0),h=h.append(o)):console.error("math.js: No argument to skewX transform!");break;case"skewY":l[0]?(r=l[0]*Math.PI/180,n=Math.tan(r),i=new g(1,n,0,1,0,0),h=h.append(i)):console.error("math.js: No argument to skewY transform!");break;case"matrix":6===l.length?h=h.append(new g(...l)):console.error("math.js: Incorrect number of arguments for matrix!");break;default:console.error("mesh.js: Unhandled transform type: "+d)}}),h},l=t=&gt;{let e=[],s=t.split(/[ ,]+/);for(let t=0,r=s.length-1;t&lt;r;t+=2)e.push(new x(parseFloat(s[t]),parseFloat(s[t+1])));return e},d=(t,e)=&gt;{for(let s in e)t.setAttribute(s,e[s])},c=(t,e,s,r,n)=&gt;{let o,i,a=[0,0,0,0];for(let h=0;h&lt;3;++h)e[h]&lt;t[h]&amp;&amp;e[h]&lt;s[h]||t[h]&lt;e[h]&amp;&amp;s[h]&lt;e[h]?a[h]=0:(a[h]=.5*((e[h]-t[h])/r+(s[h]-e[h])/n),o=Math.abs(3*(e[h]-t[h])/r),i=Math.abs(3*(s[h]-e[h])/n),a[h]&gt;o?a[h]=o:a[h]&gt;i&amp;&amp;(a[h]=i));return a},u=[[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0],[-3,3,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0],[2,-2,0,0,1,1,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0],[0,0,0,0,0,0,0,0,-3,3,0,0,-2,-1,0,0],[0,0,0,0,0,0,0,0,2,-2,0,0,1,1,0,0],[-3,0,3,0,0,0,0,0,-2,0,-1,0,0,0,0,0],[0,0,0,0,-3,0,3,0,0,0,0,0,-2,0,-1,0],[9,-9,-9,9,6,3,-6,-3,6,-6,3,-3,4,2,2,1],[-6,6,6,-6,-3,-3,3,3,-4,4,-2,2,-2,-2,-1,-1],[2,0,-2,0,0,0,0,0,1,0,1,0,0,0,0,0],[0,0,0,0,2,0,-2,0,0,0,0,0,1,0,1,0],[-6,6,6,-6,-4,-2,4,2,-3,3,-3,3,-2,-1,-2,-1],[4,-4,-4,4,2,2,-2,-2,2,-2,2,-2,1,1,1,1]],f=t=&gt;{let e=[];for(let s=0;s&lt;16;++s){e[s]=0;for(let r=0;r&lt;16;++r)e[s]+=u[s][r]*t[r]}return e},p=(t,e,s)=&gt;{const r=e*e,n=s*s,o=e*e*e,i=s*s*s;return t[0]+t[1]*e+t[2]*r+t[3]*o+t[4]*s+t[5]*s*e+t[6]*s*r+t[7]*s*o+t[8]*n+t[9]*n*e+t[10]*n*r+t[11]*n*o+t[12]*i+t[13]*i*e+t[14]*i*r+t[15]*i*o},y=t=&gt;{let e=[],s=[],r=[];for(let s=0;s&lt;4;++s)e[s]=[],e[s][0]=n(t[0][s],t[1][s],t[2][s],t[3][s]),e[s][1]=[],e[s][1].push(...n(...e[s][0][0])),e[s][1].push(...n(...e[s][0][1])),e[s][2]=[],e[s][2].push(...n(...e[s][1][0])),e[s][2].push(...n(...e[s][1][1])),e[s][2].push(...n(...e[s][1][2])),e[s][2].push(...n(...e[s][1][3]));for(let t=0;t&lt;8;++t){s[t]=[];for(let r=0;r&lt;4;++r)s[t][r]=[],s[t][r][0]=n(e[0][2][t][r],e[1][2][t][r],e[2][2][t][r],e[3][2][t][r]),s[t][r][1]=[],s[t][r][1].push(...n(...s[t][r][0][0])),s[t][r][1].push(...n(...s[t][r][0][1])),s[t][r][2]=[],s[t][r][2].push(...n(...s[t][r][1][0])),s[t][r][2].push(...n(...s[t][r][1][1])),s[t][r][2].push(...n(...s[t][r][1][2])),s[t][r][2].push(...n(...s[t][r][1][3]))}for(let t=0;t&lt;8;++t){r[t]=[];for(let e=0;e&lt;8;++e)r[t][e]=[],r[t][e][0]=s[t][0][2][e],r[t][e][1]=s[t][1][2][e],r[t][e][2]=s[t][2][2][e],r[t][e][3]=s[t][3][2][e]}return r};class x{constructor(t,e){this.x=t||0,this.y=e||0}toString(){return`(x=${this.x}, y=${this.y})`}clone(){return new x(this.x,this.y)}add(t){return new x(this.x+t.x,this.y+t.y)}scale(t){return void 0===t.x?new x(this.x*t,this.y*t):new x(this.x*t.x,this.y*t.y)}distSquared(t){let e=this.x-t.x,s=this.y-t.y;return e*e+s*s}transform(t){let e=this.x*t.a+this.y*t.c+t.e,s=this.x*t.b+this.y*t.d+t.f;return new x(e,s)}}class g{constructor(t,e,s,r,n,o){void 0===t?(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0):(this.a=t,this.b=e,this.c=s,this.d=r,this.e=n,this.f=o)}toString(){return`affine: ${this.a} ${this.c} ${this.e} \n ${this.b} ${this.d} ${this.f}`}append(t){t instanceof g||console.error("mesh.js: argument to Affine.append is not affine!");let e=this.a*t.a+this.c*t.b,s=this.b*t.a+this.d*t.b,r=this.a*t.c+this.c*t.d,n=this.b*t.c+this.d*t.d,o=this.a*t.e+this.c*t.f+this.e,i=this.b*t.e+this.d*t.f+this.f;return new g(e,s,r,n,o,i)}}class w{constructor(t,e){this.nodes=t,this.colors=e}paintCurve(t,e){if(o(this.nodes)&gt;r){const s=n(...this.nodes);let r=[[],[]],o=[[],[]];for(let t=0;t&lt;4;++t)r[0][t]=this.colors[0][t],r[1][t]=(this.colors[0][t]+this.colors[1][t])/2,o[0][t]=r[1][t],o[1][t]=this.colors[1][t];let i=new w(s[0],r),a=new w(s[1],o);i.paintCurve(t,e),a.paintCurve(t,e)}else{let s=Math.round(this.nodes[0].x);if(s&gt;=0&amp;&amp;s&lt;e){let r=4*(~~this.nodes[0].y*e+s);t[r]=Math.round(this.colors[0][0]),t[r+1]=Math.round(this.colors[0][1]),t[r+2]=Math.round(this.colors[0][2]),t[r+3]=Math.round(this.colors[0][3])}}}}class m{constructor(t,e){this.nodes=t,this.colors=e}split(){let t=[[],[],[],[]],e=[[],[],[],[]],s=[[[],[]],[[],[]]],r=[[[],[]],[[],[]]];for(let s=0;s&lt;4;++s){const r=n(this.nodes[0][s],this.nodes[1][s],this.nodes[2][s],this.nodes[3][s]);t[0][s]=r[0][0],t[1][s]=r[0][1],t[2][s]=r[0][2],t[3][s]=r[0][3],e[0][s]=r[1][0],e[1][s]=r[1][1],e[2][s]=r[1][2],e[3][s]=r[1][3]}for(let t=0;t&lt;4;++t)s[0][0][t]=this.colors[0][0][t],s[0][1][t]=this.colors[0][1][t],s[1][0][t]=(this.colors[0][0][t]+this.colors[1][0][t])/2,s[1][1][t]=(this.colors[0][1][t]+this.colors[1][1][t])/2,r[0][0][t]=s[1][0][t],r[0][1][t]=s[1][1][t],r[1][0][t]=this.colors[1][0][t],r[1][1][t]=this.colors[1][1][t];return[new m(t,s),new m(e,r)]}paint(t,e){let s,n=!1;for(let t=0;t&lt;4;++t)if((s=o([this.nodes[0][t],this.nodes[1][t],this.nodes[2][t],this.nodes[3][t]]))&gt;r){n=!0;break}if(n){let s=this.split();s[0].paint(t,e),s[1].paint(t,e)}else{new w([...this.nodes[0]],[...this.colors[0]]).paintCurve(t,e)}}}class b{constructor(t){this.readMesh(t),this.type=t.getAttribute("type")||"bilinear"}readMesh(t){let e=[[]],s=[[]],r=Number(t.getAttribute("x")),n=Number(t.getAttribute("y"));e[0][0]=new x(r,n);let o=t.children;for(let t=0,r=o.length;t&lt;r;++t){e[3*t+1]=[],e[3*t+2]=[],e[3*t+3]=[],s[t+1]=[];let r=o[t].children;for(let n=0,o=r.length;n&lt;o;++n){let o=r[n].children;for(let r=0,i=o.length;r&lt;i;++r){let i=r;0!==t&amp;&amp;++i;let h,d=o[r].getAttribute("path"),c="l";null!=d&amp;&amp;(c=(h=d.match(/\s*([lLcC])\s*(.*)/))[1]);let u=l(h[2]);switch(c){case"l":0===i?(e[3*t][3*n+3]=u[0].add(e[3*t][3*n]),e[3*t][3*n+1]=a(e[3*t][3*n],e[3*t][3*n+3]),e[3*t][3*n+2]=a(e[3*t][3*n+3],e[3*t][3*n])):1===i?(e[3*t+3][3*n+3]=u[0].add(e[3*t][3*n+3]),e[3*t+1][3*n+3]=a(e[3*t][3*n+3],e[3*t+3][3*n+3]),e[3*t+2][3*n+3]=a(e[3*t+3][3*n+3],e[3*t][3*n+3])):2===i?(0===n&amp;&amp;(e[3*t+3][3*n+0]=u[0].add(e[3*t+3][3*n+3])),e[3*t+3][3*n+1]=a(e[3*t+3][3*n],e[3*t+3][3*n+3]),e[3*t+3][3*n+2]=a(e[3*t+3][3*n+3],e[3*t+3][3*n])):(e[3*t+1][3*n]=a(e[3*t][3*n],e[3*t+3][3*n]),e[3*t+2][3*n]=a(e[3*t+3][3*n],e[3*t][3*n]));break;case"L":0===i?(e[3*t][3*n+3]=u[0],e[3*t][3*n+1]=a(e[3*t][3*n],e[3*t][3*n+3]),e[3*t][3*n+2]=a(e[3*t][3*n+3],e[3*t][3*n])):1===i?(e[3*t+3][3*n+3]=u[0],e[3*t+1][3*n+3]=a(e[3*t][3*n+3],e[3*t+3][3*n+3]),e[3*t+2][3*n+3]=a(e[3*t+3][3*n+3],e[3*t][3*n+3])):2===i?(0===n&amp;&amp;(e[3*t+3][3*n+0]=u[0]),e[3*t+3][3*n+1]=a(e[3*t+3][3*n],e[3*t+3][3*n+3]),e[3*t+3][3*n+2]=a(e[3*t+3][3*n+3],e[3*t+3][3*n])):(e[3*t+1][3*n]=a(e[3*t][3*n],e[3*t+3][3*n]),e[3*t+2][3*n]=a(e[3*t+3][3*n],e[3*t][3*n]));break;case"c":0===i?(e[3*t][3*n+1]=u[0].add(e[3*t][3*n]),e[3*t][3*n+2]=u[1].add(e[3*t][3*n]),e[3*t][3*n+3]=u[2].add(e[3*t][3*n])):1===i?(e[3*t+1][3*n+3]=u[0].add(e[3*t][3*n+3]),e[3*t+2][3*n+3]=u[1].add(e[3*t][3*n+3]),e[3*t+3][3*n+3]=u[2].add(e[3*t][3*n+3])):2===i?(e[3*t+3][3*n+2]=u[0].add(e[3*t+3][3*n+3]),e[3*t+3][3*n+1]=u[1].add(e[3*t+3][3*n+3]),0===n&amp;&amp;(e[3*t+3][3*n+0]=u[2].add(e[3*t+3][3*n+3]))):(e[3*t+2][3*n]=u[0].add(e[3*t+3][3*n]),e[3*t+1][3*n]=u[1].add(e[3*t+3][3*n]));break;case"C":0===i?(e[3*t][3*n+1]=u[0],e[3*t][3*n+2]=u[1],e[3*t][3*n+3]=u[2]):1===i?(e[3*t+1][3*n+3]=u[0],e[3*t+2][3*n+3]=u[1],e[3*t+3][3*n+3]=u[2]):2===i?(e[3*t+3][3*n+2]=u[0],e[3*t+3][3*n+1]=u[1],0===n&amp;&amp;(e[3*t+3][3*n+0]=u[2])):(e[3*t+2][3*n]=u[0],e[3*t+1][3*n]=u[1]);break;default:console.error("mesh.js: "+c+" invalid path type.")}if(0===t&amp;&amp;0===n||r&gt;0){let e=window.getComputedStyle(o[r]).stopColor.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i),a=window.getComputedStyle(o[r]).stopOpacity,h=255;a&amp;&amp;(h=Math.floor(255*a)),e&amp;&amp;(0===i?(s[t][n]=[],s[t][n][0]=Math.floor(e[1]),s[t][n][1]=Math.floor(e[2]),s[t][n][2]=Math.floor(e[3]),s[t][n][3]=h):1===i?(s[t][n+1]=[],s[t][n+1][0]=Math.floor(e[1]),s[t][n+1][1]=Math.floor(e[2]),s[t][n+1][2]=Math.floor(e[3]),s[t][n+1][3]=h):2===i?(s[t+1][n+1]=[],s[t+1][n+1][0]=Math.floor(e[1]),s[t+1][n+1][1]=Math.floor(e[2]),s[t+1][n+1][2]=Math.floor(e[3]),s[t+1][n+1][3]=h):3===i&amp;&amp;(s[t+1][n]=[],s[t+1][n][0]=Math.floor(e[1]),s[t+1][n][1]=Math.floor(e[2]),s[t+1][n][2]=Math.floor(e[3]),s[t+1][n][3]=h))}}e[3*t+1][3*n+1]=new x,e[3*t+1][3*n+2]=new x,e[3*t+2][3*n+1]=new x,e[3*t+2][3*n+2]=new x,e[3*t+1][3*n+1].x=(-4*e[3*t][3*n].x+6*(e[3*t][3*n+1].x+e[3*t+1][3*n].x)+-2*(e[3*t][3*n+3].x+e[3*t+3][3*n].x)+3*(e[3*t+3][3*n+1].x+e[3*t+1][3*n+3].x)+-1*e[3*t+3][3*n+3].x)/9,e[3*t+1][3*n+2].x=(-4*e[3*t][3*n+3].x+6*(e[3*t][3*n+2].x+e[3*t+1][3*n+3].x)+-2*(e[3*t][3*n].x+e[3*t+3][3*n+3].x)+3*(e[3*t+3][3*n+2].x+e[3*t+1][3*n].x)+-1*e[3*t+3][3*n].x)/9,e[3*t+2][3*n+1].x=(-4*e[3*t+3][3*n].x+6*(e[3*t+3][3*n+1].x+e[3*t+2][3*n].x)+-2*(e[3*t+3][3*n+3].x+e[3*t][3*n].x)+3*(e[3*t][3*n+1].x+e[3*t+2][3*n+3].x)+-1*e[3*t][3*n+3].x)/9,e[3*t+2][3*n+2].x=(-4*e[3*t+3][3*n+3].x+6*(e[3*t+3][3*n+2].x+e[3*t+2][3*n+3].x)+-2*(e[3*t+3][3*n].x+e[3*t][3*n+3].x)+3*(e[3*t][3*n+2].x+e[3*t+2][3*n].x)+-1*e[3*t][3*n].x)/9,e[3*t+1][3*n+1].y=(-4*e[3*t][3*n].y+6*(e[3*t][3*n+1].y+e[3*t+1][3*n].y)+-2*(e[3*t][3*n+3].y+e[3*t+3][3*n].y)+3*(e[3*t+3][3*n+1].y+e[3*t+1][3*n+3].y)+-1*e[3*t+3][3*n+3].y)/9,e[3*t+1][3*n+2].y=(-4*e[3*t][3*n+3].y+6*(e[3*t][3*n+2].y+e[3*t+1][3*n+3].y)+-2*(e[3*t][3*n].y+e[3*t+3][3*n+3].y)+3*(e[3*t+3][3*n+2].y+e[3*t+1][3*n].y)+-1*e[3*t+3][3*n].y)/9,e[3*t+2][3*n+1].y=(-4*e[3*t+3][3*n].y+6*(e[3*t+3][3*n+1].y+e[3*t+2][3*n].y)+-2*(e[3*t+3][3*n+3].y+e[3*t][3*n].y)+3*(e[3*t][3*n+1].y+e[3*t+2][3*n+3].y)+-1*e[3*t][3*n+3].y)/9,e[3*t+2][3*n+2].y=(-4*e[3*t+3][3*n+3].y+6*(e[3*t+3][3*n+2].y+e[3*t+2][3*n+3].y)+-2*(e[3*t+3][3*n].y+e[3*t][3*n+3].y)+3*(e[3*t][3*n+2].y+e[3*t+2][3*n].y)+-1*e[3*t][3*n].y)/9}}this.nodes=e,this.colors=s}paintMesh(t,e){let s=(this.nodes.length-1)/3,r=(this.nodes[0].length-1)/3;if("bilinear"===this.type||s&lt;2||r&lt;2){let n;for(let o=0;o&lt;s;++o)for(let s=0;s&lt;r;++s){let r=[];for(let t=3*o,e=3*o+4;t&lt;e;++t)r.push(this.nodes[t].slice(3*s,3*s+4));let i=[];i.push(this.colors[o].slice(s,s+2)),i.push(this.colors[o+1].slice(s,s+2)),(n=new m(r,i)).paint(t,e)}}else{let n,o,a,h,l,d,u;const x=s,g=r;s++,r++;let w=new Array(s);for(let t=0;t&lt;s;++t){w[t]=new Array(r);for(let e=0;e&lt;r;++e)w[t][e]=[],w[t][e][0]=this.nodes[3*t][3*e],w[t][e][1]=this.colors[t][e]}for(let t=0;t&lt;s;++t)for(let e=0;e&lt;r;++e)0!==t&amp;&amp;t!==x&amp;&amp;(n=i(w[t-1][e][0],w[t][e][0]),o=i(w[t+1][e][0],w[t][e][0]),w[t][e][2]=c(w[t-1][e][1],w[t][e][1],w[t+1][e][1],n,o)),0!==e&amp;&amp;e!==g&amp;&amp;(n=i(w[t][e-1][0],w[t][e][0]),o=i(w[t][e+1][0],w[t][e][0]),w[t][e][3]=c(w[t][e-1][1],w[t][e][1],w[t][e+1][1],n,o));for(let t=0;t&lt;r;++t){w[0][t][2]=[],w[x][t][2]=[];for(let e=0;e&lt;4;++e)n=i(w[1][t][0],w[0][t][0]),o=i(w[x][t][0],w[x-1][t][0]),w[0][t][2][e]=n&gt;0?2*(w[1][t][1][e]-w[0][t][1][e])/n-w[1][t][2][e]:0,w[x][t][2][e]=o&gt;0?2*(w[x][t][1][e]-w[x-1][t][1][e])/o-w[x-1][t][2][e]:0}for(let t=0;t&lt;s;++t){w[t][0][3]=[],w[t][g][3]=[];for(let e=0;e&lt;4;++e)n=i(w[t][1][0],w[t][0][0]),o=i(w[t][g][0],w[t][g-1][0]),w[t][0][3][e]=n&gt;0?2*(w[t][1][1][e]-w[t][0][1][e])/n-w[t][1][3][e]:0,w[t][g][3][e]=o&gt;0?2*(w[t][g][1][e]-w[t][g-1][1][e])/o-w[t][g-1][3][e]:0}for(let s=0;s&lt;x;++s)for(let r=0;r&lt;g;++r){let n=i(w[s][r][0],w[s+1][r][0]),o=i(w[s][r+1][0],w[s+1][r+1][0]),c=i(w[s][r][0],w[s][r+1][0]),x=i(w[s+1][r][0],w[s+1][r+1][0]),g=[[],[],[],[]];for(let t=0;t&lt;4;++t){(d=[])[0]=w[s][r][1][t],d[1]=w[s+1][r][1][t],d[2]=w[s][r+1][1][t],d[3]=w[s+1][r+1][1][t],d[4]=w[s][r][2][t]*n,d[5]=w[s+1][r][2][t]*n,d[6]=w[s][r+1][2][t]*o,d[7]=w[s+1][r+1][2][t]*o,d[8]=w[s][r][3][t]*c,d[9]=w[s+1][r][3][t]*x,d[10]=w[s][r+1][3][t]*c,d[11]=w[s+1][r+1][3][t]*x,d[12]=0,d[13]=0,d[14]=0,d[15]=0,u=f(d);for(let e=0;e&lt;9;++e){g[t][e]=[];for(let s=0;s&lt;9;++s)g[t][e][s]=p(u,e/8,s/8),g[t][e][s]&gt;255?g[t][e][s]=255:g[t][e][s]&lt;0&amp;&amp;(g[t][e][s]=0)}}h=[];for(let t=3*s,e=3*s+4;t&lt;e;++t)h.push(this.nodes[t].slice(3*r,3*r+4));l=y(h);for(let s=0;s&lt;8;++s)for(let r=0;r&lt;8;++r)(a=new m(l[s][r],[[[g[0][s][r],g[1][s][r],g[2][s][r],g[3][s][r]],[g[0][s][r+1],g[1][s][r+1],g[2][s][r+1],g[3][s][r+1]]],[[g[0][s+1][r],g[1][s+1][r],g[2][s+1][r],g[3][s+1][r]],[g[0][s+1][r+1],g[1][s+1][r+1],g[2][s+1][r+1],g[3][s+1][r+1]]]])).paint(t,e)}}}transform(t){if(t instanceof x)for(let e=0,s=this.nodes.length;e&lt;s;++e)for(let s=0,r=this.nodes[0].length;s&lt;r;++s)this.nodes[e][s]=this.nodes[e][s].add(t);else if(t instanceof g)for(let e=0,s=this.nodes.length;e&lt;s;++e)for(let s=0,r=this.nodes[0].length;s&lt;r;++s)this.nodes[e][s]=this.nodes[e][s].transform(t)}scale(t){for(let e=0,s=this.nodes.length;e&lt;s;++e)for(let s=0,r=this.nodes[0].length;s&lt;r;++s)this.nodes[e][s]=this.nodes[e][s].scale(t)}}document.querySelectorAll("rect,circle,ellipse,path,text").forEach((r,n)=&gt;{let o=r.getAttribute("id");o||(o="patchjs_shape"+n,r.setAttribute("id",o));const i=r.style.fill.match(/^url\(\s*"?\s*#([^\s"]+)"?\s*\)/),a=r.style.stroke.match(/^url\(\s*"?\s*#([^\s"]+)"?\s*\)/);if(i&amp;&amp;i[1]){const a=document.getElementById(i[1]);if(a&amp;&amp;"meshgradient"===a.nodeName){const i=r.getBBox();let l=document.createElementNS(s,"canvas");d(l,{width:i.width,height:i.height});const c=l.getContext("2d");let u=c.createImageData(i.width,i.height);const f=new b(a);"objectBoundingBox"===a.getAttribute("gradientUnits")&amp;&amp;f.scale(new x(i.width,i.height));const p=a.getAttribute("gradientTransform");null!=p&amp;&amp;f.transform(h(p)),"userSpaceOnUse"===a.getAttribute("gradientUnits")&amp;&amp;f.transform(new x(-i.x,-i.y)),f.paintMesh(u.data,l.width),c.putImageData(u,0,0);const y=document.createElementNS(t,"image");d(y,{width:i.width,height:i.height,x:i.x,y:i.y});let g=l.toDataURL();y.setAttributeNS(e,"xlink:href",g),r.parentNode.insertBefore(y,r),r.style.fill="none";const w=document.createElementNS(t,"use");w.setAttributeNS(e,"xlink:href","#"+o);const m="patchjs_clip"+n,M=document.createElementNS(t,"clipPath");M.setAttribute("id",m),M.appendChild(w),r.parentElement.insertBefore(M,r),y.setAttribute("clip-path","url(#"+m+")"),u=null,l=null,g=null}}if(a&amp;&amp;a[1]){const o=document.getElementById(a[1]);if(o&amp;&amp;"meshgradient"===o.nodeName){const i=parseFloat(r.style.strokeWidth.slice(0,-2))*(parseFloat(r.style.strokeMiterlimit)||parseFloat(r.getAttribute("stroke-miterlimit"))||1),a=r.getBBox(),l=Math.trunc(a.width+i),c=Math.trunc(a.height+i),u=Math.trunc(a.x-i/2),f=Math.trunc(a.y-i/2);let p=document.createElementNS(s,"canvas");d(p,{width:l,height:c});const y=p.getContext("2d");let g=y.createImageData(l,c);const w=new b(o);"objectBoundingBox"===o.getAttribute("gradientUnits")&amp;&amp;w.scale(new x(l,c));const m=o.getAttribute("gradientTransform");null!=m&amp;&amp;w.transform(h(m)),"userSpaceOnUse"===o.getAttribute("gradientUnits")&amp;&amp;w.transform(new x(-u,-f)),w.paintMesh(g.data,p.width),y.putImageData(g,0,0);const M=document.createElementNS(t,"image");d(M,{width:l,height:c,x:0,y:0});let S=p.toDataURL();M.setAttributeNS(e,"xlink:href",S);const k="pattern_clip"+n,A=document.createElementNS(t,"pattern");d(A,{id:k,patternUnits:"userSpaceOnUse",width:l,height:c,x:u,y:f}),A.appendChild(M),o.parentNode.appendChild(A),r.style.stroke="url(#"+k+")",g=null,p=null,S=null}}})}();</script> </svg> ``` --- Comment by @dnfield on Feb 25, 2021 This would require getting Flutter to support mesh gradients upstream. I think that's probably doable. On the web it's a bit trickier.
package,p: flutter_svg
low
Critical
2,655,940,635
flutter
[flutter_svg] SvgPicture from assets aligment property does not work
_Imported from https://github.com/dnfield/flutter_svg/issues/503_ Original report by @M1chlCZ on Mar 1, 2021 In latest version of 0.21.0-nullsafety.0 Aligment does not work, chaning property value does not change anything. This is report for pre-release however with latest Android Studio on Windows 10, I was able to install only latest beta build of flutter which reuires nullsafety packages. So that´s what I need to work with. Otherwise I am getting compilation errors. --- Comment by @marcospsviana on Mar 1, 2021 The same problem for me, using vscode manjaro linux, version flutter_svg 0.19.3 doesn't work. I just change in pubspec.yaml : flutter_svg: "0.19.0" it's work.
package,p: flutter_svg
low
Critical
2,655,940,811
flutter
[flutter_svg] SvgPicture default to IconTheme
_Imported from https://github.com/dnfield/flutter_svg/issues/510_ Original report by @Keetz on Mar 10, 2021 I think it would be awesome if the SvgPicture properties would default to the IconTheme. Right now something like this has to be done if we want to use the IconTheme. ``` SvgPicture.asset( 'assets/images/some_icon.svg', color: Theme.of(context).iconTheme.color, width: Theme.of(context).iconTheme.size, height: Theme.of(context).iconTheme.size, // And so on ) ``` This doesn't make much sense for the SvgPicture() in itself, but maybe if we had a SvgIcon() like mentioned briefly here https://github.com/dnfield/flutter_svg/issues/2#issuecomment-392359862 --- Comment by @JulianBissekkou on Jun 29, 2022 I would love to see that feature as described by the comment.
package,p: flutter_svg
low
Minor
2,655,941,019
flutter
[flutter_svg] Performance to render many SVG in an animation
_Imported from https://github.com/dnfield/flutter_svg/issues/511_ Original report by @tbarbette on Mar 10, 2021 Hi all, I have an animation with basically many leaves falling of a tree and staying on the ground (in a 2D animation). Each leaf is an instance of one of 14 leaves, which are DrawableRoot read using this package. Now, with the leaves staying on the ground it gets slower and slower. And as leaves keep falling, I must render the picture many times per second. Would it be more performant to convert the DrawableRoot to a ui.Image, Picture, a Bitmap? And then use those instead of the DrawableRoot? Or another solution? Thanks, Tom --- Comment by @phuongtinhbien on Apr 22, 2021 I got the same problem. FPS on list with too much svg that allways under 15fps eventhough I cached image --- Comment by @tbarbette on Apr 22, 2021 I reverted to using pre-loaded PNGs... It's much more efficient. --- Comment by @dnfield on Apr 22, 2021 It really depends on the complexity of what you're drawing - sometimes using a rasterized version is more efficient, especially if there's a lot of complicated graphics ops in the drawing :\ --- Comment by @somavoyager on Jul 19, 2021 I apologize to dust up this old issue. I have complex set of SVG files that take bit of time (3-4 seconds) to render. Once the svg files are loaded into memory (on drawn in canvas), the subsequent rendering is quick in other screens. Is there a way to preload the svg assets? I can show a loading screen upfront to the user when loading the svg files. --- Comment by @dnfield on Jul 19, 2021 Rasterize it to an image.
package,p: flutter_svg
low
Major
2,655,941,214
flutter
[flutter_svg] robust error handling
_Imported from https://github.com/dnfield/flutter_svg/issues/515_ Original report by @dreamer2q on Mar 13, 2021 This is a svg source ```svg <svg xmlns:xlink="http://www.w3.org/1999/xlink" width="1.743ex" height="3.009ex" style="vertical-align: -0.338ex;" viewBox="0 -1150.1 750.5 1295.7" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" aria-labelledby="MathJax-SVG-1-Title"> <title id="MathJax-SVG-1-Title">\vec A</title> <defs aria-hidden="true"> <path stroke-width="1" id="E1-MJMATHI-41" d="M208 74Q208 50 254 46Q272 46 272 35Q272 34 270 22Q267 8 264 4T251 0Q249 0 239 0T205 1T141 2Q70 2 50 0H42Q35 7 35 11Q37 38 48 46H62Q132 49 164 96Q170 102 345 401T523 704Q530 716 547 716H555H572Q578 707 578 706L606 383Q634 60 636 57Q641 46 701 46Q726 46 726 36Q726 34 723 22Q720 7 718 4T704 0Q701 0 690 0T651 1T578 2Q484 2 455 0H443Q437 6 437 9T439 27Q443 40 445 43L449 46H469Q523 49 533 63L521 213H283L249 155Q208 86 208 74ZM516 260Q516 271 504 416T490 562L463 519Q447 492 400 412L310 260L413 259Q516 259 516 260Z"></path> <path stroke-width="1" id="E1-MJMAIN-20D7" d="M-123 694Q-123 702 -118 708T-103 714Q-93 714 -88 706T-80 687T-67 660T-40 633Q-29 626 -29 615Q-29 606 -36 600T-53 590T-83 571T-121 531Q-135 516 -143 516T-157 522T-163 536T-152 559T-129 584T-116 595H-287L-458 596Q-459 597 -461 599T-466 602T-469 607T-471 615Q-471 622 -458 635H-99Q-123 673 -123 694Z"></path> </defs> <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)" aria-hidden="true"> <use xlink:href="#E1-MJMATHI-41" x="0" y="0"></use> <use xlink:href="#E1-MJMAIN-20D7" x="749" y="309"></use> </g> </svg> ``` In which, it has `currentColor` property, which cannot be parsed correctly by flutter_svg, whilst the browse can handle this, I wonder how can flutter_svg be more robust and throw less error but warns to indicate unexpected situations! Thanks in advance. --- Comment by @adlion on Apr 1, 2022 +1
package,p: flutter_svg
low
Critical
2,655,941,416
flutter
[flutter_svg] Image is not displaying properly
_Imported from https://github.com/dnfield/flutter_svg/issues/518_ Original report by @deepak786 on Mar 15, 2021 I have the image icon_list.svg <details> <summary>icon_list.svg</summary> ``` <svg xmlns="http://www.w3.org/2000/svg" width="27" height="19" viewBox="0 0 27 19"> <g id="Icon_feather-list" data-name="Icon feather-list" transform="translate(-3 -7.5)"> <path id="Path_1384" data-name="Path 1384" d="M12,9H31.5" transform="translate(-3)" fill="none" stroke="#d1d1d1" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/> <path id="Path_1385" data-name="Path 1385" d="M12,18H31.5" transform="translate(-3 -1)" fill="none" stroke="#d1d1d1" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/> <path id="Path_1386" data-name="Path 1386" d="M12,27H31.5" transform="translate(-3 -2)" fill="none" stroke="#d1d1d1" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/> <path id="Path_1387" data-name="Path 1387" d="M4.5,9h0" fill="none" stroke="#d1d1d1" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/> <path id="Path_1388" data-name="Path 1388" d="M4.5,18h0" transform="translate(0 -1)" fill="none" stroke="#d1d1d1" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/> <path id="Path_1389" data-name="Path 1389" d="M4.5,27h0" transform="translate(0 -2)" fill="none" stroke="#d1d1d1" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/> </g> </svg> ``` </details> <img width="166" alt="Screen Shot 2021-03-15 at 2 48 41 PM" src="https://user-images.githubusercontent.com/14223997/111130725-8dc83500-859d-11eb-8e18-5450f19a14f2.png"> But the code displays only the lines. It is not displaying the circles in the image. <details> <summary>Code Sample</summary> ``` import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Padding( padding: const EdgeInsets.all(10.0), child: Column( children: [ SvgPicture.asset( "assets/icon_list.svg", color: Colors.black, ), ], ), ), ); } } ``` </details> ![Simulator Screen Shot - iPhone 11 Pro Max - 2021-03-15 at 14 56 49](https://user-images.githubusercontent.com/14223997/111132004-dc2a0380-859e-11eb-9ea8-54c676d04ecb.png) --- Comment by @dnfield on Apr 6, 2021 I'm not quite sure why the browser does what it does here. The horizontal line is 0 pixels. --- Comment by @dnfield on Apr 6, 2021 As a workaround, even changing those paths to have `h.0001` makes the circles show up. Per the spec, that value should be the number of pixels to draw a horizontal line. It looks like Chrome interprets that as hairline, whereas this package interprets it as 0. I'd be curious what other renderers do.
package,p: flutter_svg
low
Minor
2,655,941,601
flutter
[flutter_svg] Crash when have a different color format in svg
_Imported from https://github.com/dnfield/flutter_svg/issues/519_ Original report by @Tryliom on Mar 16, 2021 When we have a svg with a `color="rgb(102 102 102)"` instead of `color="rgb(102, 102, 102)"`, it crash while on web navigator this is valid. The svg: ```svg <svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"   viewBox="0 0 25 25" enable-background="new 0 0 25 25" xml:space="preserve">   <g>   <line fill="none" stroke="rgb(102 102 102)" stroke-width="3" stroke-miterlimit="10" x1="8.3" y1="9.8" x2="9.8" y2="1.8"/>   <line fill="none" stroke="rgb(102 102 102)" stroke-width="3" stroke-miterlimit="10" x1="7.5" y1="15.5" x2="1.5" y2="10.2"/>   <line fill="none" stroke="rgb(102 102 102)" stroke-width="3" stroke-miterlimit="10" x1="12.3" y1="18.8" x2="4" y2="20.1"/>   <line fill="none" stroke="rgb(102 102 102)" stroke-width="3" stroke-miterlimit="10" x1="21.9" y1="3.7" x2="12.6" y2="9"/>   <line fill="none" stroke="rgb(102 102 102)" stroke-width="3" stroke-miterlimit="10" x1="17.7" y1="10.4" x2="23.5" y2="17.5"/>   <line fill="none" stroke="rgb(102 102 102)" stroke-width="3" stroke-miterlimit="10" x1="17.7" y1="16.8" x2="14.8" y2="23.2"/>   </g> </svg> ``` --- Comment by @dnfield on Apr 6, 2021 The spec requires a comma - that said, I'd be somewhat open to supporting this since browsers probably do.
package,p: flutter_svg
low
Critical
2,655,941,827
flutter
[flutter_svg] would you please instead of throwing an error, display a svg with no load
_Imported from https://github.com/dnfield/flutter_svg/issues/535_ Original report by @trailerzone on Apr 16, 2021 Instead of throwing an error when the asset could not load, would you replace the asset with no a load or error asset? That way those of us on slower computers can keep the ios app open and not having to restart to emulator every time. Thanks! I could change the code myself if I get time. --- Comment by @dnfield on Apr 16, 2021 I'm not quite sure what you mean here. What's the issue? --- Comment by @NamanShergill on Apr 21, 2021 > I'm not quite sure what you mean here. What's the issue? He means an error builder where one can show an error widget if the svg failed to load --- Comment by @martipello on Apr 30, 2021 > > I'm not quite sure what you mean here. What's the issue? > > He means an error builder where one can show an error widget if the svg failed to load Im not sure he did but your idea is much better --- Comment by @mekhribonu-s-codexoptimus on Jun 1, 2022 @xal why it's closed? would it be posted later? I can't find a way to catch exceptions to display errorWidget
package,p: flutter_svg
low
Critical
2,655,942,004
flutter
[flutter_svg] Support loadingBuilder
_Imported from https://github.com/dnfield/flutter_svg/issues/543_ Original report by @creativecreatorormaybenot on Apr 25, 2021 ## Feature request The Flutter framework has support for an [`Image.loadingBuilder`](https://api.flutter.dev/flutter/widgets/Image/loadingBuilder.html). It would be very useful to have this for `SvgPicture` as well. ## Use case Currently, we only have [`SvgPicture.placeholderBuilder`](https://pub.dev/documentation/flutter_svg/latest/svg/SvgPicture/placeholderBuilder.html). However, when we want to show loading progress, we cannot use it. The best I can think of right now is doing the network (and possibly parsing) calls myself and retrieving the loading progress from there. --- Comment by @dnfield on Apr 26, 2021 I'm not opposed to this, but I'm also not sure when I'll get to it right now. I'd be happy to review a PR - it's probably a pretty straightforward porting of the framework impl to here.
package,p: flutter_svg
low
Minor
2,655,942,200
flutter
[flutter_svg] SvgPicture.network errorBuilder
_Imported from https://github.com/dnfield/flutter_svg/issues/544_ Original report by @KristianBalaj on Apr 30, 2021 Is there any option to use e.g. `errorBuilder` in case of network fetch or svg parse error? Something like currently the `placeholderBuilder` but in case of an error? --- Comment by @khaitran1234 on May 7, 2021 The same problem --- Comment by @qcks on May 17, 2021 SvgPicture.*** .errorBuilder --- Comment by @yohantsn on Sep 8, 2021 any news about it? --- Comment by @CelticMajora on Nov 23, 2021 Would also love this! --- Comment by @mstich-mcmservices on Oct 27, 2023 Same. I have several SVGs that throw an exception while parsing and I have no way to detect this condition. --- Comment by @animator on Dec 16, 2023 Same here. --- Comment by @omarahmedx14 on Jan 10, 2024 same here .. --- Comment by @Reprevise on Jan 10, 2024 This would be very nice to have. I know the underlying `VectorGraphics` widget takes an `errorBuilder`, and I was considering submitting a PR, but I couldn't get it the `errorBuilder` callback to trigger when I set the status code of the fake http response to 400 in the tests. Does VG's `errorBuilder` only trigger on decode failures? @dnfield
package,p: flutter_svg
low
Critical
2,655,942,392
flutter
[flutter_svg] stroke-width doesn't work with <g/>
_Imported from https://github.com/dnfield/flutter_svg/issues/551_ Original report by @vishna on May 11, 2021 ## The Problem stroke width that doesn't get applied when used with a `g` tag (this renders fine on web) <img width="78" alt="Screenshot 2021-05-11 at 11 28 45" src="https://user-images.githubusercontent.com/121164/117792966-108f0880-b24c-11eb-8ca8-9f747fd20329.png"> ```svg <svg width="64" height="64" xmlns="http://www.w3.org/2000/svg"><g stroke-width="3" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"><path stroke="#000" d="M21 26h22v32H21z"/></g></svg> ``` Move stroke width down to `path` tag, and tada 🎉 <img width="80" alt="Screenshot 2021-05-11 at 11 31 23" src="https://user-images.githubusercontent.com/121164/117793345-6cf22800-b24c-11eb-9713-018f8516e863.png"> ```svg <svg width="64" height="64" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"><path stroke-width="3" stroke="#000" d="M21 26h22v32H21z"/></g></svg> ``` ## Expected behaviour Both svg sources render exactly same bitmap
package,p: flutter_svg
low
Minor
2,655,942,579
flutter
[flutter_svg] Blend mode between two SVG
_Imported from https://github.com/dnfield/flutter_svg/issues/557_ Original report by @dan-leech on May 22, 2021 Maybe I do not understand blending right... I have two svg with shapes of different colors. ```svg <svg width="22" height="19" viewBox="0 0 22 19" fill="#00FF00" xmlns="http://www.w3.org/2000/svg"> <path d="M11.3044 18.8246H3.61473C1.51756 18.8246 0.219298 16.5277 1.21795 14.7302L5.11271 8.03916L9.00746 1.34818C10.106 -0.449394 12.7025 -0.449394 13.7011 1.34818L17.5959 8.03916L21.4906 14.7302C22.5891 16.5277 21.191 18.8246 19.0939 18.8246H11.3044Z"/> </svg> ``` - They all are in Stack. - I apply colorBlendMode: BlendMode.color to each or any other. - Nothing changes. What is working and how: - If I add `color:` param I see blend effect like colored squares instead shapes and no blending between different SvgPicture widgets. What's the proper way to achieve something like this between two different SvgPicture widgets? ![](https://i.stack.imgur.com/OeTdh.png) --- Comment by @dan-leech on May 22, 2021 I've found the way to achieve this: ```dart BlendMask( opacity: _spotOpacity.value, blendMode: _blendMode, child: SvgPicture.asset('assets/triangle.svg')); ``` ```dart class BlendMask extends SingleChildRenderObjectWidget { final BlendMode blendMode; final double opacity; const BlendMask({ required this.blendMode, required Widget child, this.opacity = 1.0, Key? key, }) : super(key: key, child: child); @override RenderObject createRenderObject(BuildContext context) => RenderBlendMask(blendMode, opacity); @override void updateRenderObject(BuildContext context, RenderBlendMask renderObject) { renderObject ..blendMode = blendMode ..opacity = opacity; } } class RenderBlendMask extends RenderProxyBox { BlendMode blendMode; double opacity; RenderBlendMask(this.blendMode, this.opacity); @override void paint(PaintingContext context, Offset offset) { context.canvas.saveLayer( offset & size, Paint() ..blendMode = blendMode ..color = Color.fromARGB((opacity * 255).round(), 255, 255, 255)); super.paint(context, offset); context.canvas.restore(); } } ```
package,p: flutter_svg
low
Minor
2,655,942,790
flutter
[flutter_svg] Error to open svg: Invalid double 100%
_Imported from https://github.com/dnfield/flutter_svg/issues/559_ Original report by @Ron-Junior on May 25, 2021 So when opening this link [https://s3.glbimg.com/v1/AUTH_58d78b787ec34892b5aaa0c7a146155f/cartola_svg_185/escudo/01/33/58/0085562bf0-96a3-4227-9d76-8c46fd9ccc0120210502223358](url) We have this error: Invalid double 100% So the problem here is that the function parseDouble on "svg/parser_state.dart" only removes the px string to the "maybeDouble" variable. So.. in my humble opinion the solutions is ` maybeDouble = maybeDouble.trim().replaceFirst(RegExp(r'(px|%)'), '');` The stack trace below: When the exception was thrown, this was the stack #0 double.parse (dart:core-patch/double_patch.dart:111:28) #1 parseDouble package:flutter_svg/…/utilities/numbers.dart:15 #2 _Paths.rect package:flutter_svg/…/svg/parser_state.dart:655 #3 SvgParserState.addShape package:flutter_svg/…/svg/parser_state.dart:874 #4 SvgParserState.startElement package:flutter_svg/…/svg/parser_state.dart:902 --- Comment by @smallbad on Jun 8, 2021 I also met this problem, but it's wrong to just remove the percentage sign. The percentage appears in the inner label of SVG, hoping that it will fill the whole SVG space. Simply removing the percentage sign will cause the problem of abnormal width and height. He should find the height and width of his parent element --- Comment by @kimmanwky on Aug 5, 2021 anyone fixed this issue? i have the same problem. It is still not working on v0.22.0. --- Comment by @ZaifSenpai on Jan 7, 2022 Same issue occurred while trying to show [this SVG](https://api.dicebear.com/5.x/initials/svg?seed=nfc921FkibWpTQtVCMcMfTwwNL2fx74IU3oyQCnpErVR77sFgeU0Wl9a422CwCJmwhD7ZJSvr7ETVl9NZC0JIWPrVqE2Fos15Uscl3AmDX60y2bIB6Og2zCrH302ND&radius=0&scale=100&flip=false&rotate=0&translateX=0&translateY=0) --- Comment by @pansitwattana on Feb 7, 2022 Hello, I also got this error. How to fix this bugs? P.S. I can't modify image I download from network. --- Comment by @pansitwattana on Feb 8, 2022 I got solution here. I don't know if this is the best solution. using this library: https://pub.dev/packages/flutter_inappwebview ``` InAppWebView( initialUrlRequest: URLRequest( url: Uri.dataFromString( '''<svg width="100%" height="100%"> <image xlink:href="$qrCodeSvgUrl" width="100%" height="100%"/> </svg>''', mimeType: 'text/html', encoding: Encoding.getByName('utf-8'), ), ), ), ``` --- Comment by @gerken-tss on Oct 7, 2022 @pansitwattana Your solution works, not bad! The only drawback is that all the caching capabilities and other things like placeholder widgets that are part of the `flutter_svg` package are not directly available like this. As a temporary workaround, it's fine though, I guess. --- Comment by @ynsmrkrds on Aug 10, 2023 Hello. Is there a new solution? --- Comment by @YashIngole on Oct 9, 2023 any solution yet? --- Comment by @angelru on Oct 17, 2023 any solution?? Invalid double --- Comment by @JuKu on Jan 6, 2024 Same problem here. Maybe flutter_svg is incompatible with any SVGs which use the "fill" command? --- Comment by @gentunian on Feb 27, 2024 same here for a flag svg I need to render: ``` <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-2100 -1470 4200 2940"> <defs> <path id="D" fill-rule="evenodd" d="m-31.5 0h33a30 30 0 0 0 30 -30v-10a30 30 0 0 0 -30 -30h-33zm13-13h19a19 19 0 0 0 19 -19v-6a19 19 0 0 0 -19 -19h-19z"/> <path id="E" transform="translate(-31.5)" d="m0 0h63v-13h-51v-18h40v-12h-40v-14h48v-13h-60z"/> <path id="e" d="m-26.25 0h52.5v-12h-40.5v-16h33v-12h-33v-11h39.25v-12h-51.25z"/> <g id="G"> <clipPath id="gcut"> <path d="m-31.5 0v-70h63v70zm31.5-47v12h31.5v-12z"/> </clipPath> <use xlink:href="#O" clip-path="url(#gcut)"/> <rect y="-35" x="5" height="10" width="26.5"/> <rect y="-35" x="21.5" height="35" width="10"/> </g> <path id="M" d="m-31.5 0h12v-48l14 48h11l14-48v48h12v-70h-17.5l-14 48-14-48h-17.5z"/> <path id="O" fill-rule="evenodd" d="m0 0a31.5 35 0 0 0 0 -70 31.5 35 0 0 0 0 70m0-13a18.5 22 0 0 0 0 -44 18.5 22 0 0 0 0 44"/> <path id="P" fill-rule="evenodd" d="m-31.5 0h13v-26h28a22 22 0 0 0 0 -44h-40zm13-39h27a9 9 0 0 0 0 -18h-27z"/> <g id="R"> <use xlink:href="#P"/> <path d="m28 0c0-10 0-32-15-32h-19c22 0 22 22 22 32"/> </g> <path id="S" d="m-15.75-22c0 7 6.75 10.5 16.75 10.5s14.74-3.25 14.75-7.75c0-14.25-46.75-5.25-46.5-30.25 0.25-21.5 24.75-20.5 33.75-20.5s26 4 25.75 21.25h-15.25c0-7.5-7-10.25-15-10.25-7.75 0-13.25 1.25-13.25 8.5-0.25 11.75 46.25 4 46.25 28.75 0 18.25-18 21.75-31.5 21.75-11.5 0-31.55-4.5-31.5-22z"/> <g id="star" fill="#fff"> <g id="c"> <path id="t" transform="rotate(18 0,-1)" d="m0-1v1h0.5"/> <use xlink:href="#t" transform="scale(-1,1)"/> </g> <use xlink:href="#c" transform="rotate(72)"/> <use xlink:href="#c" transform="rotate(-72)"/> <use xlink:href="#c" transform="rotate(144)"/> <use xlink:href="#c" transform="rotate(216)"/> </g> <use id="star1" xlink:href="#star" transform="scale(31.5)"/> <use id="star2" xlink:href="#star" transform="scale(26.25)"/> <use id="star3" xlink:href="#star" transform="scale(21)"/> <use id="star4" xlink:href="#star" transform="scale(15)"/> <use id="star5" xlink:href="#star" transform="scale(10.5)"/> </defs> <rect y="-50%" x="-50%" height="100%" fill="#009b3a" width="100%"/> <path d="m-1743 0 1743 1113 1743-1113-1743-1113z" fill="#fedf00"/> <circle r="735" fill="#002776"/> <clipPath id="band"> <circle r="735"/> </clipPath> <path fill="#fff" d="m-2205 1470a1785 1785 0 0 1 3570 0h-105a1680 1680 0 1 0 -3360 0z" clip-path="url(#band)"/> <g transform="translate(-420,1470)" fill="#009b3a"> <use y="-1697.5" xlink:href="#O" transform="rotate(-7)"/> <use y="-1697.5" xlink:href="#R" transform="rotate(-4)"/> <use y="-1697.5" xlink:href="#D" transform="rotate(-1)"/> <use y="-1697.5" xlink:href="#E" transform="rotate(2)"/> <use y="-1697.5" xlink:href="#M" transform="rotate(5)"/> <use y="-1697.5" xlink:href="#e" transform="rotate(9.75)"/> <use y="-1697.5" xlink:href="#P" transform="rotate(14.5)"/> <use y="-1697.5" xlink:href="#R" transform="rotate(17.5)"/> <use y="-1697.5" xlink:href="#O" transform="rotate(20.5)"/> <use y="-1697.5" xlink:href="#G" transform="rotate(23.5)"/> <use y="-1697.5" xlink:href="#R" transform="rotate(26.5)"/> <use y="-1697.5" xlink:href="#E" transform="rotate(29.5)"/> <use y="-1697.5" xlink:href="#S" transform="rotate(32.5)"/> <use y="-1697.5" xlink:href="#S" transform="rotate(35.5)"/> <use y="-1697.5" xlink:href="#O" transform="rotate(38.5)"/> </g> <use id="&#x3B1;CMi" y="-132" x="-600" xlink:href="#star1"/> <use id="&#x3B1;CMa" y="177" x="-535" xlink:href="#star1"/> <use id="&#x3B2;CMa" y="243" x="-625" xlink:href="#star2"/> <use id="&#x3B3;CMa" y="132" x="-463" xlink:href="#star4"/> <use id="&#x3B4;CMa" y="250" x="-382" xlink:href="#star2"/> <use id="&#x3B5;CMa" y="323" x="-404" xlink:href="#star3"/> <use id="&#x3B1;Vir" y="-228" x="228" xlink:href="#star1"/> <use id="&#x3B1;Sco" y="258" x="515" xlink:href="#star1"/> <use id="&#x3B2;Sco" y="265" x="617" xlink:href="#star3"/> <use id="&#x3B5;Sco" y="323" x="545" xlink:href="#star2"/> <use id="&#x3B8;Sco" y="477" x="368" xlink:href="#star2"/> <use id="&#x3B9;Sco" y="551" x="367" xlink:href="#star3"/> <use id="&#x3BA;Sco" y="419" x="441" xlink:href="#star3"/> <use id="&#x3BB;Sco" y="382" x="500" xlink:href="#star2"/> <use id="&#x3BC;Sco" y="405" x="365" xlink:href="#star3"/> <use id="&#x3B1;Hya" y="30" x="-280" xlink:href="#star2"/> <use id="&#x3B3;Hya" y="-37" x="200" xlink:href="#star3"/> <use id="&#x3B1;Cru" y="330" xlink:href="#star1"/> <use id="&#x3B2;Cru" y="184" x="85" xlink:href="#star2"/> <use id="&#x3B3;Cru" y="118" xlink:href="#star2"/> <use id="&#x3B4;Cru" y="184" x="-74" xlink:href="#star3"/> <use id="&#x3B5;Cru" y="235" x="-37" xlink:href="#star4"/> <use id="&#x3B1;TrA" y="495" x="220" xlink:href="#star2"/> <use id="&#x3B2;TrA" y="430" x="283" xlink:href="#star3"/> <use id="&#x3B3;TrA" y="412" x="162" xlink:href="#star3"/> <use id="&#x3B1;Car" y="390" x="-295" xlink:href="#star1"/> <use id="&#x3C3;Oct" y="575" xlink:href="#star5"/> </svg> ``` Stack trace: ``` [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FormatException: Invalid double -50% #0 double.parse (dart:core-patch/double_patch.dart:112:28) #1 parseDouble (package:vector_graphics_compiler/src/svg/numbers.dart:32:17) #2 parseDoubleWithUnits (package:vector_graphics_compiler/src/svg/numbers.dart:82:25) #3 SvgParser.parseDoubleWithUnits (package:vector_graphics_compiler/src/svg/parser.dart:975:20) #4 _Paths.rect (package:vector_graphics_compiler/src/svg/parser.dart:506:34) #5 SvgParser.addShape (package:vector_graphics_compiler/src/svg/parser.dart:892:31) #6 SvgParser.startElement (package:vector_graphics_compiler/src/svg/parser.dart:920:12) #7 SvgParser._parseTree (package:vector_graphics_compiler/src/svg/parser.dart:766:13) #8 SvgParser.parse (package:vector_graphics_compiler/src/svg/parser.dart:799:5) #9 parse (package:vector_graphics_compiler/vector_graphics_compiler.dart:76:17) #10 encodeSvg (package:vector_graphics_<…> ``` --- Comment by @Judimax on Mar 17, 2024 I think the fix is simple grab the width and the height of the svg grab the percentage value and work with it that way? --- Comment by @Jyoshnarani on Jun 5, 2024 [2.0.10](https://pub.dev/packages/flutter_svg/versions/2.0.10) latest version has same error Unhandled Exception: FormatException: Invalid double 100% --- Comment by @deminearchiver on Jun 25, 2024 I really want this fixed too! --- Comment by @WingCH on Aug 21, 2024 same issue --- Comment by @JuKu on Sep 5, 2024 @dnfield Can you provide a solution for this problem, please?
package,p: flutter_svg
low
Critical
2,655,942,991
flutter
[flutter_svg] text dominant-baseline, letter-spacing attributes do not work
_Imported from https://github.com/dnfield/flutter_svg/issues/561_ Original report by @jangho-chu on May 27, 2021 I'm using flutter_svg package version 0.19.1 ``` <text dominant-baseline="hanging" text-anchor="start" x="30" y="161" font-size="32" font-family="East Sea Dokdo" font-weight="normal" letter-spacing="-0.04em" fill="#151515"> MyText </text> ``` * dominant-baseline, letter-spacing do not work Is there any solution? --- Comment by @dnfield on May 27, 2021 They aren't implemented. Letter spacing is probably a matter of just using https://api.flutter.dev/flutter/painting/TextStyle/letterSpacing.html, not sure about dominant-baseline. Happy to review a patch that adds this. --- Comment by @jangho-chu on May 27, 2021 Thank you for your reply :)
package,p: flutter_svg
low
Minor
2,655,943,222
flutter
[flutter_svg] PowerPoint export / clipPath not shown
_Imported from https://github.com/dnfield/flutter_svg/issues/566_ Original report by @adrianvintu on Jun 7, 2021 I have exported two objects from PowerPoint and ```SvgPicture.asset``` does not display them. I assume it's the same issue as https://github.com/dnfield/flutter_svg/issues/343 and/or https://github.com/dnfield/flutter_svg/issues/136 . Is there a way for you to check and maybe do the magical simplification on them? Magical - also because I have no clue how SVGs work. Thank you very much! BLUE ``` <svg width="67" height="141" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" overflow="hidden"><defs><clipPath id="clip0"><rect x="162" y="195" width="67" height="141"/></clipPath></defs><g clip-path="url(#clip0)" transform="translate(-162 -195)"><path d="M179.25 265.5 179.25 228.706C179.25 219.712 186.562 212.353 195.5 212.353 204.438 212.353 211.75 219.712 211.75 228.706L211.75 265.5 179.25 265.5ZM228 302.294 228 228.706C228 210.718 213.375 196 195.5 196 177.625 196 163 210.718 163 228.706L163 302.294C163 320.282 177.625 335 195.5 335 213.375 335 228 320.282 228 302.294Z" fill="#00B0F0" fill-rule="evenodd"/></g></svg> ``` BOTTLE ``` <svg width="181" height="296" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" overflow="hidden"><defs><clipPath id="clip0"><rect x="407" y="171" width="181" height="296"/></clipPath></defs><g clip-path="url(#clip0)" transform="translate(-407 -171)"><path d="M587 416.833 587 384.056 447.909 384.056C443.409 384.056 439.727 380.368 439.727 375.861L439.727 293.917C439.727 289.41 443.409 285.722 447.909 285.722L587 285.722 587 252.945C587 243.931 579.636 236.556 570.636 236.556L556.318 236.556C555.091 236.556 554.273 235.736 554.273 234.507L554.273 222.215C554.273 220.986 555.091 220.167 556.318 220.167L566.546 220.167C569 220.167 570.636 218.528 570.636 216.069L570.636 187.389C570.636 178.375 563.273 171 554.273 171L439.727 171C430.727 171 423.364 178.375 423.364 187.389L423.364 216.069C423.364 218.528 425 220.167 427.455 220.167L437.682 220.167C438.909 220.167 439.727 220.986 439.727 222.215L439.727 234.507C439.727 235.736 438.909 236.556 437.682 236.556L423.364 236.556C414.364 236.556 407 243.931 407 252.945L407 449.611C407 458.625 414.364 466 423.364 466L480.636 466C480.636 438.958 502.727 416.833 529.727 416.833L587 416.833Z" fill="#00B0F0" fill-rule="evenodd"/><path d="M457 306.125 457 363.875C457 366.35 458.625 368 461.062 368L587 368 587 302 461.062 302C458.625 302 457 303.65 457 306.125Z" fill="#00B0F0" fill-rule="evenodd"/><path d="M457 411.833C457 405.85 461.85 401 467.833 401L576.167 401C582.15 401 587 405.85 587 411.833L587 455.166C587 461.15 582.15 466 576.167 466L467.833 466C461.85 466 457 461.15 457 455.166Z" fill="#00B0F0" fill-rule="evenodd"/></g></svg> ``` --- Comment by @adrianvintu on Aug 24, 2022 For people who need to simplify their SVGs https://github.com/RazrFalcon/svgcleaner-gui/releases https://stackoverflow.com/questions/66649982/flutter-web-unhandled-element-filter-on-svg
package,p: flutter_svg
low
Minor
2,655,943,442
flutter
[flutter_svg] Nested Svg's
_Imported from https://github.com/dnfield/flutter_svg/issues/570_ Original report by @Howmuchadollarcost on Jun 17, 2021 Multiple nested svg's and parsing svg height and width are not working. Any workarounds? OR if there is any thoughts about adding it? --- Comment by @jakusb on Jun 25, 2021 Yes please!
package,p: flutter_svg
low
Minor
2,655,943,641
flutter
[flutter_svg] Add Support for vector-effects
_Imported from https://github.com/dnfield/flutter_svg/issues/571_ Original report by @Rossdex on Jun 18, 2021 I have an app that requires viewing large scale svg's in high detail. Below I have an example SVG that has _non-scaling-stroke_ attribute on one of the boxes, if I display this using SVGPicture.asset when I increase the size of the SVG by putting it into an overflow box the scaling is wrong. Is there a way we can get the package to listen to _vector-effect="non-scaling-stroke"_ ? Any help/ Advise would be much appreciated. ``<svg viewBox="0 0 90 45" xmlns="http://www.w3.org/2000/svg"> <rect x="1" y="1" width="40" height="40" fill="white" stroke="blue" stroke-width="1px" vector-effect="non-scaling-stroke"/> <rect x="45" y="1" width="40" height="40" fill="white" stroke="green" stroke-width="1px" /> </svg>`` **Example Code** `Container( clipBehavior: Clip.none, child: new OverflowBox( minWidth: 0.0, minHeight: 0.0, maxWidth: double.infinity, child: SvgPicture.asset( 'assets/example.svg', fit: BoxFit.cover, width: 800 * 30, height: 600 * 30, ), ), )` --- Comment by @dnfield on Jun 18, 2021 I have mixed feelings about implementing anything from the SVG 2 spec - its browser support is really limited and I'm worried about it causing more confusion than help. I'm also not quite sure what would be necessary to support this attribute. That said, I'd be happy to review aPR that attempts it.
package,p: flutter_svg
low
Minor
2,655,943,817
flutter
[flutter_svg] Package is not compatible with Stacking operation.
_Imported from https://github.com/dnfield/flutter_svg/issues/577_ Original report by @dopaminista on Jul 18, 2021 Stack widget is not compatible with flutter_svg. Svg images are always rendered in front. I can't stack text widget SVG images. --- Comment by @dnfield on Jul 19, 2021 Please share a reproduction.
package,p: flutter_svg
low
Minor
2,655,944,018
flutter
[flutter_svg] Unable to load assets is not fixed
_Imported from https://github.com/dnfield/flutter_svg/issues/579_ Original report by @Ankit0080 on Jul 29, 2021 This is my Pubspec.yaml file version: 1.0.0+1 environment: sdk: ">=2.7.0 <3.0.0" dependencies: flutter: sdk: flutter fluttertoast: ^3.1.3 page_transition: "^1.1.7+2" # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.0 json_annotation: ^3.1.1 shared_preferences: ^2.0.5 flutter_svg: ^0.22.0 dev_dependencies: build_runner: ^1.11.5 json_serializable: ^3.5.1 flutter_test: sdk: flutter http: any # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true assets: - assets/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. # For details regarding adding assets from package dependencies, see # https://flutter.dev/assets-and-images/#from-packages # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: fonts: - family: NotoSansMedium fonts: - asset: assets/fonts/NotoSans-Medium.ttf - family: NotoSansBold fonts: - asset: assets/fonts/NotoSans-Bold.ttf - family: NotoSansRegular fonts: - asset: assets/fonts/NotoSans-Regular.ttf - family: NotoSansItalic fonts: - asset: assets/fonts/NotoSans-Italic.ttf \ This is my svg loading code Row( children: <Widget>[ SvgPicture.asset("assets/calendar.svg") ], ) Expected behaviour : Should work Result : Unable to load asets throwing exception i have put image name and the image is stored in asstest folder --- Comment by @marcov-dart on Jul 30, 2021 Pretty sure this is unrelated to this package. It is odd though, because it I have it working. I have cupertino_icons and uses-material-design: true, svg assets, png assets and fonts setup in pubspec.yaml. I do have stop the app after adding an asset, then run flutter pub get and then start it again. Flutter pub get and then restart does not work for me with the Unable to load assets exception being thrown. But that is not related to svg assets alone. The same is true for the png assets. Also make sure you have the indentation correct in the pubspec.yaml. It is stupidly sensitive to indentation. --- Comment by @AndrejBykov on Aug 16, 2021 I have the same issue, and i used in parallel flutter image.asset widget which loaded the assets files, but the svgPicture.asset unable to load asset --- Comment by @AndrejBykov on Aug 16, 2021 This is shame because what for then this package benn created if it doesn't provide what expected --- Comment by @Ankit0080 on Sep 29, 2021 "Unable to load assets" everytime this package throw this exception. --- Comment by @dnfield on Sep 29, 2021 I'd need a full reproduction of this. This is likely an issue with the way the pubspec is set up in the project rather than this package.
package,p: flutter_svg
low
Minor
2,655,944,238
flutter
[flutter_svg] Provide option to ignore errors
_Imported from https://github.com/dnfield/flutter_svg/issues/580_ Original report by @martin-robert-fink on Aug 3, 2021 I'm using Omnigraffle to create SVG assets and it provides extra elements (example: "metadata" is used to include version information) and it also includes "font-face" (I'm using a font loaded from assets, so it's not an issue). But, these cause flutter_svg to output errors as these are not supported elements. My stuff renders fine, I just want to have the ability to remove these parsing errors as they are not helpful. --- Comment by @dnfield on Aug 16, 2021 Is there some reason that you can't just remove the unused tags from your file? It would both reduce the parse time and the bundle size of your application. --- Comment by @martin-robert-fink on Aug 16, 2021 Hi Dan - Thanks for checking in. No, technically, there's no reason and that is my current workaround. The issue is that I do all of my app icons this way (I have about 50 of them so far), and it was a bit tedious to manually go remove all the unused/unsupported tags by hand. My next move is to write a dart based command line tool to automate the process. If you tell this is not something worth dealing with, I'll do that. I guess I was always of a mind that unsupported tags are just ignored rather than generate error messages, but maybe there's a good reason for it and I'm not aware. --- Comment by @dnfield on Aug 16, 2021 I've found `svgcleaner` to be pretty good at cleaning a lot of that stuff up and compressing the SVG down a bit further. If you have a build rule set up for that it'd be cool to add here or in another package. --- Comment by @martin-robert-fink on Aug 16, 2021 Thanks for the pointer, I will give it a try. In my read through the docs though, it looks like it won't remove font-face which is one of the problem elements. Thanks again! --- Comment by @dnfield on Aug 16, 2021 Ahhh yes you are right. --- Comment by @dnfield on Aug 16, 2021 ....the other option is of course to just support font-face :) --- Comment by @martin-robert-fink on Aug 16, 2021 Well, get on that :)....
package,p: flutter_svg
low
Critical
2,655,962,449
flutter
[flutter_svg] Masks do not work in some cases
_Imported from https://github.com/dnfield/flutter_svg/issues/586_ Original report by @vidklopcic on Aug 17, 2021 I noticed that sometimes masks do not work as expected. I attached the SVG where nothing gets rendered if mask is present. ```HTML <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" stroke-linecap="round" stroke-linejoin="round" stroke-width="0" fill-rule="evenodd" width="47.8633" height="48.279" viewBox="2032.6 698 47863.3 48279"> <defs> <mask id="_DVWUPeC7JPp_clear-1" fill="#000" stroke="#000"> <g> <rect x="2032.6" y="2425" width="47863.3" height="44109.1" fill="#fff"/> <path d="M 46749.4 5892.8 46442.1 5892.8 46442.1 5570 46732.5 5570 46749.4 5571.4 46769.2 5572.8 46791.7 5574.2 46814.3 5577 46836.8 5581.2 46856.6 5586.9 46859.4 5588.3 46865 5591.1 46873.5 5595.3 46884.8 5601 46897.4 5609.4 46910.1 5619.3 46922.8 5632 46932.7 5646.1 46934.1 5647.5 46936.9 5653.1 46941.1 5661.6 46946.8 5672.9 46951 5685.6 46955.2 5699.6 46958.1 5716.6 46959.5 5733.5 46959.5 5734.9 46959.5 5736.3 46958.1 5744.8 46956.6 5757.5 46953.8 5774.4 46946.8 5791.3 46938.3 5811 46925.6 5829.3 46908.7 5847.7 46905.9 5849.1 46898.8 5854.7 46887.6 5861.8 46869.3 5870.2 46848.1 5878.7 46819.9 5885.7 46787.5 5891.4 46749.4 5892.8"/> </g> </mask> </defs> <g fill="currentColor" stroke="currentColor" transform="translate(0,49675) scale(1,-1)"> <g mask="url(#_DVWUPeC7JPp_clear-1)"> <path d="M 46776.2 5999.9 46788.9 5999.9 46818.5 5998.5 46849.5 5994.3 46883.4 5990 46914.4 5983 46929.9 5978.8 46942.6 5974.5 46944 5974.5 46945.4 5973.1 46953.8 5968.9 46966.5 5963.3 46982 5953.4 46998.9 5940.7 47017.3 5923.8 47034.2 5904 47051.1 5881.5 47051.1 5880.1 47052.5 5878.7 47058.2 5870.2 47063.8 5856.1 47072.3 5837.8 47079.3 5816.6 47086.3 5791.3 47090.6 5764.5 47092 5734.9 47092 5733.5 47092 5730.7 47092 5725 47090.6 5718 47090.6 5708.1 47089.2 5698.2 47083.5 5674.3 47075.1 5646.1 47063.8 5616.5 47046.9 5586.9 47035.6 5572.8 47024.3 5558.7 47022.9 5557.3 47021.5 5555.9 47017.3 5551.6 47011.6 5547.4 47004.6 5541.8 46996.1 5536.1 46984.8 5529.1 46973.6 5520.6 46959.5 5513.6 46944 5506.5 46927.1 5498.1 46908.7 5491 46887.6 5485.4 46866.4 5478.3 46842.5 5474.1 46817.1 5469.9 46819.9 5468.5 46825.6 5465.6 46834 5460 46845.3 5454.4 46870.7 5438.8 46883.4 5429 46894.6 5420.5 46897.4 5417.7 46904.5 5410.7 46915.8 5399.4 46929.9 5385.3 46945.4 5365.6 46963.7 5344.4 46982 5319 47001.8 5290.8 47169.5 5025.8 47008.8 5025.8 46880.5 5228.8 46880.5 5230.2 46877.7 5233 46874.9 5237.3 46870.7 5242.9 46860.8 5258.4 46848.1 5278.2 46832.6 5299.3 46817.1 5321.8 46801.6 5343 46787.5 5362.7 46786.1 5364.1 46781.8 5369.8 46774.8 5378.2 46764.9 5388.1 46743.8 5409.2 46732.5 5419.1 46721.2 5427.6 46719.8 5429 46717 5430.4 46711.4 5433.2 46702.9 5437.4 46694.5 5441.7 46684.6 5445.9 46662 5453 46660.6 5453 46657.8 5454.4 46652.1 5454.4 46645.1 5455.8 46635.2 5457.2 46624 5457.2 46608.5 5458.6 46442.1 5458.6 46442.1 5025.8 46312.4 5025.8 46312.4 6001.3 46764.9 6001.3 46776.2 5999.9"/> </g> </g> </svg> ``` https://github.com/dnfield/flutter_svg/issues/241 might be related?
package,p: flutter_svg
low
Minor
2,655,962,574
flutter
[flutter_svg] unexpected size when using Transform.rotate
_Imported from https://github.com/dnfield/flutter_svg/issues/591_ Original report by @berg223 on Aug 26, 2021 ## Description Both size of horizonMatchstick and verticalMatchstick in the code is unexpected. ## Reproduce flutter code: ```dart import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'dart:math' as math; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: buildTest(), ); } Widget buildTest() { double width = 137.2; double height = width / 7.5; return SizedBox( width: width, height: width, child: Stack( children: [ Center( child: Transform.rotate( angle: -math.pi / 4, child: horizonMatchstick(width, height)), ), Center( child: Transform.rotate( angle: -math.pi / 4, child: verticalMatchstick(height, width )), ), ], )); } Widget horizonMatchstick(double width, double height) { return SvgPicture.asset( "assets/matchstick.svg", width: width, height: height, ); } Widget verticalMatchstick(double width, double height) { return SvgPicture.asset( "assets/matchstick_up.svg", width: width, height: height, ); } } ``` code in assets/matchstick.svg ```svg <?xml version="1.0"?> <svg width="25" height="5" viewBox="0 0 25 5" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="grad1" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:rgb(255, 153, 0);stop-opacity:1" /> <stop offset="60%" style="stop-color:rgb(255, 153, 0);stop-opacity:1" /> <stop offset="61%" style="stop-color:#cc7a00;stop-opacity:1" /> <stop offset="100%" style="stop-color:#cc7a00;stop-opacity:1" /> </linearGradient> </defs> <rect x="0" y="0" fill="url(#grad1)" width="25" height="5" rx="2" ry="2.5"/> <ellipse cx="23" cy="2.5" rx="2" ry="2.5" style="fill:#ff471a;"/> </svg> ``` code in assets/matchstick_up.svg ```svg <?xml version="1.0"?> <svg width="5" height="25" viewBox="0 0 5 25" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" style="stop-color:rgb(255, 153, 0);stop-opacity:1" /> <stop offset="60%" style="stop-color:rgb(255, 153, 0);stop-opacity:1" /> <stop offset="61%" style="stop-color:#cc7a00;stop-opacity:1" /> <stop offset="100%" style="stop-color:#cc7a00;stop-opacity:1" /> </linearGradient> </defs> <rect x="0" y="0" fill="url(#grad1)" width="5" height="25" rx="2.5" ry="2"/> <ellipse cx="2.5" cy="2" rx="2.5" ry="2" style="fill:#ff471a;"/> </svg> ``` --- Comment by @berg223 on Aug 26, 2021 @dnfield could u please have a look? --- Comment by @berg223 on Aug 26, 2021 What I knows for now: if replace Stack as Column, the issue still exists. --- Comment by @berg223 on Aug 27, 2021 The issue is that svg cannot support width and height at the same time. --- Comment by @dnfield on Aug 27, 2021 I'm not sure I fully grasp the bug here - what do you expect this to look like? I wonder if you just need to experiment with the `fit` property, but it's hard to say without knowing exactly what you expect the output to look like vs. what you're getting. --- Comment by @berg223 on Aug 28, 2021 @dnfield I just want to set height and width at the same time. And i don't want to preserve the aspect. Is that possiable? --- Comment by @bdlukaa on Sep 5, 2021 Use a `RotatedBox` insated of Transform.rotate
package,p: flutter_svg
low
Critical
2,655,962,694
vscode
Editor GPU: Implement GPU-based selection
WIP fork of selections.ts before I got the DOM-based rendering working: ```ts /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { dispose, toDisposable } from '../../../../base/common/lifecycle.js'; import { EditorOption } from '../../../common/config/editorOptions.js'; import { Range } from '../../../common/core/range.js'; import * as viewEvents from '../../../common/viewEvents.js'; import type { ViewportData } from '../../../common/viewLayout/viewLinesViewportData.js'; import { ViewContext } from '../../../common/viewModel/viewContext.js'; import type { IObjectCollectionBufferEntry } from '../../gpu/objectCollectionBuffer.js'; import type { RectangleRendererEntrySpec } from '../../gpu/rectangleRenderer.js'; import { ViewGpuContext } from '../../gpu/viewGpuContext.js'; import { DynamicViewOverlay } from '../../view/dynamicViewOverlay.js'; import { RenderingContext, type HorizontalRange, type LineVisibleRanges, type RestrictedRenderingContext } from '../../view/renderingContext.js'; import { ViewPart } from '../../view/viewPart.js'; import { ViewLineOptions } from '../viewLines/viewLineOptions.js'; const enum CornerStyle { EXTERN, INTERN, FLAT } interface IVisibleRangeEndPointStyle { top: CornerStyle; bottom: CornerStyle; } class HorizontalRangeWithStyle { public left: number; public width: number; public startStyle: IVisibleRangeEndPointStyle | null; public endStyle: IVisibleRangeEndPointStyle | null; constructor(other: HorizontalRange) { this.left = other.left; this.width = other.width; this.startStyle = null; this.endStyle = null; } } class LineVisibleRangesWithStyle { public lineNumber: number; public ranges: HorizontalRangeWithStyle[]; constructor(lineNumber: number, ranges: HorizontalRangeWithStyle[]) { this.lineNumber = lineNumber; this.ranges = ranges; } } function toStyledRange(item: HorizontalRange): HorizontalRangeWithStyle { return new HorizontalRangeWithStyle(item); } function toStyled(item: LineVisibleRanges): LineVisibleRangesWithStyle { return new LineVisibleRangesWithStyle(item.lineNumber, item.ranges.map(toStyledRange)); } /** * This view part displays selected text to the user. Every line has its own selection overlay. */ export class SelectionsGpu extends ViewPart { private readonly _gpuShapes: IObjectCollectionBufferEntry<RectangleRendererEntrySpec>[] = []; private _roundedSelection: boolean; private _typicalHalfwidthCharacterWidth: number; private _selections: Range[]; private _renderResult: string[] | null; constructor( context: ViewContext, private readonly _viewGpuContext: ViewGpuContext ) { super(context); const options = this._context.configuration.options; this._roundedSelection = options.get(EditorOption.roundedSelection); this._typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth; this._selections = []; this._renderResult = null; this._context.addEventHandler(this); this._register(toDisposable(() => { this._context.removeEventHandler(this); this._renderResult = null; })); } // #region Event handlers public override onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean { const options = this._context.configuration.options; this._roundedSelection = options.get(EditorOption.roundedSelection); this._typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth; return true; } public override onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean { this._selections = e.selections.slice(0); return true; } // #endregion private _visibleRangesHaveGaps(linesVisibleRanges: LineVisibleRangesWithStyle[]): boolean { for (let i = 0, len = linesVisibleRanges.length; i < len; i++) { const lineVisibleRanges = linesVisibleRanges[i]; if (lineVisibleRanges.ranges.length > 1) { // There are two ranges on the same line return true; } } return false; } private _enrichVisibleRangesWithStyle(viewport: Range, linesVisibleRanges: LineVisibleRangesWithStyle[], previousFrame: LineVisibleRangesWithStyle[] | null): void { const epsilon = this._typicalHalfwidthCharacterWidth / 4; let previousFrameTop: HorizontalRangeWithStyle | null = null; let previousFrameBottom: HorizontalRangeWithStyle | null = null; if (previousFrame && previousFrame.length > 0 && linesVisibleRanges.length > 0) { const topLineNumber = linesVisibleRanges[0].lineNumber; if (topLineNumber === viewport.startLineNumber) { for (let i = 0; !previousFrameTop && i < previousFrame.length; i++) { if (previousFrame[i].lineNumber === topLineNumber) { previousFrameTop = previousFrame[i].ranges[0]; } } } const bottomLineNumber = linesVisibleRanges[linesVisibleRanges.length - 1].lineNumber; if (bottomLineNumber === viewport.endLineNumber) { for (let i = previousFrame.length - 1; !previousFrameBottom && i >= 0; i--) { if (previousFrame[i].lineNumber === bottomLineNumber) { previousFrameBottom = previousFrame[i].ranges[0]; } } } if (previousFrameTop && !previousFrameTop.startStyle) { previousFrameTop = null; } if (previousFrameBottom && !previousFrameBottom.startStyle) { previousFrameBottom = null; } } for (let i = 0, len = linesVisibleRanges.length; i < len; i++) { // We know for a fact that there is precisely one range on each line const curLineRange = linesVisibleRanges[i].ranges[0]; const curLeft = curLineRange.left; const curRight = curLineRange.left + curLineRange.width; const startStyle = { top: CornerStyle.EXTERN, bottom: CornerStyle.EXTERN }; const endStyle = { top: CornerStyle.EXTERN, bottom: CornerStyle.EXTERN }; if (i > 0) { // Look above const prevLeft = linesVisibleRanges[i - 1].ranges[0].left; const prevRight = linesVisibleRanges[i - 1].ranges[0].left + linesVisibleRanges[i - 1].ranges[0].width; if (abs(curLeft - prevLeft) < epsilon) { startStyle.top = CornerStyle.FLAT; } else if (curLeft > prevLeft) { startStyle.top = CornerStyle.INTERN; } if (abs(curRight - prevRight) < epsilon) { endStyle.top = CornerStyle.FLAT; } else if (prevLeft < curRight && curRight < prevRight) { endStyle.top = CornerStyle.INTERN; } } else if (previousFrameTop) { // Accept some hiccups near the viewport edges to save on repaints startStyle.top = previousFrameTop.startStyle!.top; endStyle.top = previousFrameTop.endStyle!.top; } if (i + 1 < len) { // Look below const nextLeft = linesVisibleRanges[i + 1].ranges[0].left; const nextRight = linesVisibleRanges[i + 1].ranges[0].left + linesVisibleRanges[i + 1].ranges[0].width; if (abs(curLeft - nextLeft) < epsilon) { startStyle.bottom = CornerStyle.FLAT; } else if (nextLeft < curLeft && curLeft < nextRight) { startStyle.bottom = CornerStyle.INTERN; } if (abs(curRight - nextRight) < epsilon) { endStyle.bottom = CornerStyle.FLAT; } else if (curRight < nextRight) { endStyle.bottom = CornerStyle.INTERN; } } else if (previousFrameBottom) { // Accept some hiccups near the viewport edges to save on repaints startStyle.bottom = previousFrameBottom.startStyle!.bottom; endStyle.bottom = previousFrameBottom.endStyle!.bottom; } curLineRange.startStyle = startStyle; curLineRange.endStyle = endStyle; } } private _getVisibleRangesWithStyle(selection: Range, ctx: RenderingContext, previousFrame: LineVisibleRangesWithStyle[] | null): LineVisibleRangesWithStyle[] { const _linesVisibleRanges = ctx.linesVisibleRangesForRange(selection, true) || []; const linesVisibleRanges = _linesVisibleRanges.map(toStyled); const visibleRangesHaveGaps = this._visibleRangesHaveGaps(linesVisibleRanges); if (!visibleRangesHaveGaps && this._roundedSelection) { this._enrichVisibleRangesWithStyle(ctx.visibleRange, linesVisibleRanges, previousFrame); } // The visible ranges are sorted TOP-BOTTOM and LEFT-RIGHT return linesVisibleRanges; } private _createSelectionPiece(top: number, bottom: number, className: string, left: number, width: number): string { return ( '<div class="cslr ' + className + '" style="' + 'top:' + top.toString() + 'px;' + 'bottom:' + bottom.toString() + 'px;' + 'left:' + left.toString() + 'px;' + 'width:' + width.toString() + 'px;' + '"></div>' ); } private _actualRenderOneSelection(visibleStartLineNumber: number, hasMultipleSelections: boolean, visibleRanges: LineVisibleRangesWithStyle[], viewportData: ViewportData, options: ViewLineOptions): void { if (visibleRanges.length === 0) { console.log('no visible ranges'); return; } const visibleRangesHaveStyle = !!visibleRanges[0].ranges[0].startStyle; const firstLineNumber = visibleRanges[0].lineNumber; const lastLineNumber = visibleRanges[visibleRanges.length - 1].lineNumber; // for (let y = selection.startLineNumber; y <= selection.endLineNumber; y++) { // if (ViewGpuContext.canRender(options, ctx.viewportData, y)) { // console.log('render selection', y, selection.startColumn); // this._gpuShapes.push(this._viewGpuContext.rectangleRenderer.register(selection.startColumn * 10, y * 10, 100, 10, 1, 0, 0, 1)); // } // } for (let i = 0, len = visibleRanges.length; i < len; i++) { const lineVisibleRanges = visibleRanges[i]; const lineNumber = lineVisibleRanges.lineNumber; // const lineIndex = lineNumber - visibleStartLineNumber; // if (ViewGpuContext.canRender(options, viewportData, lineNumber)) { // console.log('render selection', lineNumber, lineVisibleRanges.ranges); // for (let j = 0, lenJ = lineVisibleRanges.ranges.length; j < lenJ; j++) { // const visibleRange = lineVisibleRanges.ranges[j]; // this._gpuShapes.push(this._viewGpuContext.rectangleRenderer.register(visibleRange.left, lineNumber * 10, visibleRange.width, 10, 1, 0, 0, 1)); // } // } // const top = hasMultipleSelections ? (lineNumber === firstLineNumber ? 1 : 0) : 0; // const bottom = hasMultipleSelections ? (lineNumber !== firstLineNumber && lineNumber === lastLineNumber ? 1 : 0) : 0; // let innerCornerOutput = ''; // let restOfSelectionOutput = ''; // for (let j = 0, lenJ = lineVisibleRanges.ranges.length; j < lenJ; j++) { // const visibleRange = lineVisibleRanges.ranges[j]; // if (visibleRangesHaveStyle) { // const startStyle = visibleRange.startStyle!; // const endStyle = visibleRange.endStyle!; // if (startStyle.top === CornerStyle.INTERN || startStyle.bottom === CornerStyle.INTERN) { // // Reverse rounded corner to the left // // First comes the selection (blue layer) // innerCornerOutput += this._createSelectionPiece(top, bottom, SelectionsOverlay.SELECTION_CLASS_NAME, visibleRange.left - SelectionsOverlay.ROUNDED_PIECE_WIDTH, SelectionsOverlay.ROUNDED_PIECE_WIDTH); // // Second comes the background (white layer) with inverse border radius // let className = SelectionsOverlay.EDITOR_BACKGROUND_CLASS_NAME; // if (startStyle.top === CornerStyle.INTERN) { // className += ' ' + SelectionsOverlay.SELECTION_TOP_RIGHT; // } // if (startStyle.bottom === CornerStyle.INTERN) { // className += ' ' + SelectionsOverlay.SELECTION_BOTTOM_RIGHT; // } // innerCornerOutput += this._createSelectionPiece(top, bottom, className, visibleRange.left - SelectionsOverlay.ROUNDED_PIECE_WIDTH, SelectionsOverlay.ROUNDED_PIECE_WIDTH); // } // if (endStyle.top === CornerStyle.INTERN || endStyle.bottom === CornerStyle.INTERN) { // // Reverse rounded corner to the right // // First comes the selection (blue layer) // innerCornerOutput += this._createSelectionPiece(top, bottom, SelectionsOverlay.SELECTION_CLASS_NAME, visibleRange.left + visibleRange.width, SelectionsOverlay.ROUNDED_PIECE_WIDTH); // // Second comes the background (white layer) with inverse border radius // let className = SelectionsOverlay.EDITOR_BACKGROUND_CLASS_NAME; // if (endStyle.top === CornerStyle.INTERN) { // className += ' ' + SelectionsOverlay.SELECTION_TOP_LEFT; // } // if (endStyle.bottom === CornerStyle.INTERN) { // className += ' ' + SelectionsOverlay.SELECTION_BOTTOM_LEFT; // } // innerCornerOutput += this._createSelectionPiece(top, bottom, className, visibleRange.left + visibleRange.width, SelectionsOverlay.ROUNDED_PIECE_WIDTH); // } // } // let className = SelectionsOverlay.SELECTION_CLASS_NAME; // if (visibleRangesHaveStyle) { // const startStyle = visibleRange.startStyle!; // const endStyle = visibleRange.endStyle!; // if (startStyle.top === CornerStyle.EXTERN) { // className += ' ' + SelectionsOverlay.SELECTION_TOP_LEFT; // } // if (startStyle.bottom === CornerStyle.EXTERN) { // className += ' ' + SelectionsOverlay.SELECTION_BOTTOM_LEFT; // } // if (endStyle.top === CornerStyle.EXTERN) { // className += ' ' + SelectionsOverlay.SELECTION_TOP_RIGHT; // } // if (endStyle.bottom === CornerStyle.EXTERN) { // className += ' ' + SelectionsOverlay.SELECTION_BOTTOM_RIGHT; // } // } // restOfSelectionOutput += this._createSelectionPiece(top, bottom, className, visibleRange.left, visibleRange.width); // } // output2[lineIndex][0] += innerCornerOutput; // output2[lineIndex][1] += restOfSelectionOutput; } } private _previousFrameVisibleRangesWithStyle: (LineVisibleRangesWithStyle[] | null)[] = []; public prepareRender(ctx: RenderingContext): void { console.log('selections', this._selections); // TODO: Improve caching across frames dispose(this._gpuShapes); this._gpuShapes.length = 0; const options = new ViewLineOptions(this._context.configuration, this._context.theme.type); const visibleStartLineNumber = ctx.visibleRange.startLineNumber; const thisFrameVisibleRangesWithStyle: (LineVisibleRangesWithStyle[] | null)[] = []; for (let i = 0, len = this._selections.length; i < len; i++) { const selection = this._selections[i]; if (selection.isEmpty()) { thisFrameVisibleRangesWithStyle[i] = null; continue; } const visibleRangesWithStyle = this._getVisibleRangesWithStyle(selection, ctx, this._previousFrameVisibleRangesWithStyle[i]); thisFrameVisibleRangesWithStyle[i] = visibleRangesWithStyle; this._actualRenderOneSelection(visibleStartLineNumber, this._selections.length > 1, visibleRangesWithStyle, ctx.viewportData, options); } this._previousFrameVisibleRangesWithStyle = thisFrameVisibleRangesWithStyle; // this._renderResult = output.map(([internalCorners, restOfSelection]) => internalCorners + restOfSelection); } public override render(ctx: RestrictedRenderingContext): void { // if (!this._renderResult) { // return ''; // } // const lineIndex = lineNumber - startLineNumber; // if (lineIndex < 0 || lineIndex >= this._renderResult.length) { // return ''; // } // return this._renderResult[lineIndex]; } // private _updateEntries(reader: IReader | undefined) { // const options = this._context.configuration.options; // const rulers = options.get(EditorOption.rulers); // const typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth; // const devicePixelRatio = this._viewGpuContext.devicePixelRatio.read(reader); // for (let i = 0, len = rulers.length; i < len; i++) { // const ruler = rulers[i]; // const shape = this._gpuShapes[i]; // const color = ruler.color ? Color.fromHex(ruler.color) : this._context.theme.getColor(editorRuler) ?? Color.white; // const rulerData = [ // ruler.column * typicalHalfwidthCharacterWidth * devicePixelRatio, // 0, // Math.max(1, Math.ceil(devicePixelRatio)), // Number.MAX_SAFE_INTEGER, // color.rgba.r / 255, // color.rgba.g / 255, // color.rgba.b / 255, // color.rgba.a, // ] as const; // if (!shape) { // this._gpuShapes[i] = this._viewGpuContext.rectangleRenderer.register(...rulerData); // } else { // shape.setRaw(rulerData); // } // } // while (this._gpuShapes.length > rulers.length) { // this._gpuShapes.splice(-1, 1)[0].dispose(); // } // } } function abs(n: number): number { return n < 0 ? -n : n; } ```
plan-item,editor-gpu
medium
Minor
2,655,962,729
flutter
[flutter_svg] Flutter_svg doens´t work over network
_Imported from https://github.com/dnfield/flutter_svg/issues/601_ Original report by @roberto-donext on Sep 22, 2021 I have test this plugin using the network constructor and doesn´t work: I get this error: The following ProgressEvent$ object was thrown resolving a single-frame picture stream: [object ProgressEvent] When the exception was thrown, this was the stack Picture provider: NetworkPicture("https://DOMAIN/right-arrow.svg", headers: null, colorFilter: null) Picture key: NetworkPicture("https://DOMAIN/right-arrow.svg", headers: null, colorFilter: null) My code is: ``` Column( children: [ SvgPicture.network( "https://DOMAIN/public/right-arrow.svg", width: 100, height: 100, semanticsLabel: 'A shark?!', placeholderBuilder: (BuildContext context) => Container( padding: const EdgeInsets.all(10), child: const CircularProgressIndicator(), ), ) ], ) ``` I tested this exactly SVG over the network (doesn´t work) and just copy it in the assets folder, so , using SvgPicture.asset. And this works... So, the problem is not in the svg, because is exactly the same. The problem i guest is with the Plugin. I event tried to set the headers to this: headers: {'Content-Type': 'image/svg+xml'}, But does not work as well. Any suggestion? Thanks --- Comment by @zanpen2000 on Dec 15, 2021 got same problem here, any one ? --- Comment by @Sunsiha on Mar 2, 2022 any solution? --- Comment by @jacoblee1021 on Jan 21, 2023 same issue. --- Comment by @apoleo88 on Jan 31, 2023 Same, for Flutter Web, it doesn't happen with the same SVG as an asset but gives an error when stored in Google Cloud Storage. ``` ======== Exception caught by SVG =================================================================== The following ProgressEvent$ object was thrown resolving a single-frame picture stream: [object ProgressEvent] When the exception was thrown, this was the stack: Picture provider: NetworkPicture("https://firebasestorage.googleapis.com/v0/b/not_rea_bucket_name/o/ace.svg?alt=media", headers: null, colorFilter: null) Picture key: PictureKey(Instance of 'NetworkPictureKeyData', colorFilter: null, theme: SvgTheme(currentColor: Color(0xff000000), fontSize: 16, xHeight: 8)) ==================================================================================================== ``` ``` Flutter 3.7.0 • channel stable Framework • revision b06b8b2710 (8 days ago) • 2023-01-23 16:55:55 -0800 Engine • revision b24591ed32 Tools • Dart 2.19.0 • DevTools 2.20.1 ``` --- Comment by @apoleo88 on Feb 2, 2023 My bad. My issue was with web **CORS** restriction. `flutter_svg` caught Exception doesn't show the real one, that was for me: `XMLHttpRequest error` --- Comment by @davor-layer-four on Sep 12, 2023 > My bad. My issue was with web **CORS** restriction. > > `flutter_svg` caught Exception doesn't show the real one, that was for me: `XMLHttpRequest error` How did you fix your issue? I am having the same problem --- Comment by @davor-layer-four on Sep 19, 2023 > > My bad. My issue was with web **CORS** restriction. > > `flutter_svg` caught Exception doesn't show the real one, that was for me: `XMLHttpRequest error` > > How did you fix your issue? I am having the same problem I fixed it, it was related to CORS and Firebase Storage. Just follow this youtube video: https://www.youtube.com/watch?v=tvCIEsk4Uas
package,p: flutter_svg
low
Critical
2,655,962,875
flutter
[flutter_svg] BUG: Weird result with scroll
_Imported from https://github.com/dnfield/flutter_svg/issues/603_ Original report by @LucaDillenburg on Sep 24, 2021 As you can see in the video below, the SVG disappears somehow. It seems related to the SVG area not being not completely visible. https://user-images.githubusercontent.com/30930222/134613436-5bf585ff-4fb9-4e70-9a17-a71565ec092d.mov Do you know why this is happening? Can it be solved by changing the value of some parameters? I believe this is a bug, but I am not entirely sure. --- Comment by @dnfield on Sep 24, 2021 Does this reproduce on a real device? If so, can you share a minimal reproduction? --- Comment by @dnfield on Sep 24, 2021 (Also, does it reproduce on the latest version of master flutter) --- Comment by @LucaDillenburg on Sep 24, 2021 It does reproduce on a real device in the latest version of master. A minimal reproducible can be found here: https://github.com/LucaDillenburg/Flutter-SVG-Issue-Report The issue only appears in the web. It runs correctly in iOS. --- Comment by @LucaDillenburg on Sep 27, 2021 Do you have any idea why this is happening? I really need this to be fixed and I can help if you want me to. No experience with this package code, though. --- Comment by @dnfield on Sep 27, 2021 It would be really helpful if you could bisect this to a specific version of flutter, e.g. using `git bisect`. --- Comment by @aytunch on Nov 4, 2021 @dnfield I am having the exact same issue in Web Html renderer. And we need the html renderer unfortunately. Our web app is going to be opened through Instagram links so will be displayed in a webview in instagram and load times are essenstial. You can see from the video that vertical `GridView` scrolling do not change the svg rendering but scrolling the horizontal `PageView` affects the SVG rendering. Look at the 2 SVGs at the header. The SVGs in the `GridView` items are somehow not affected as much by this bug. Mostly the Location and Verified svgs. https://user-images.githubusercontent.com/6442915/140411236-e8a5ae53-ba80-464a-8d28-734f966d75a5.mov Using: flutter_svg: ^0.23.0+1 Flutter 2.5.3 stable --- Comment by @dnfield on Nov 4, 2021 I don't believe this is a bug in flutter_svg. But again, the same ask: do you have a small reproduction of this, and/or can you bisect it to a particular commit in Flutter where it started happening (if it ever didn't happen). --- Comment by @zphoenixz on Dec 2, 2021 This bug also happend to me on mobile browsers (Chrome, Firefox and Safari) on the other side it worked as expected on the same desktop apps. flutter_svg v1.0.0 Flutter: [✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [✓] Xcode - develop for iOS and macOS [✓] Chrome - develop for the web [✓] Android Studio (version 4.1) [✓] VS Code (version 1.62.3) --- Comment by @zphoenixz on Dec 3, 2021 > Ok I found that this happens when your SVG has masked content, remove the masked part and it will show as expected, perhaps this is a partial solution. --- Comment by @aytunch on Dec 3, 2021 @zphoenixz thanks for the investigation. @dnfield does flutter_svg support masked content in svgs? Is there a specific reason why they work fine in canvasKit web and mobile native but not in html? Is it something about flutter web engine? --- Comment by @dnfield on Dec 3, 2021 It's probably a bug in the html backend mask impl. Can you share an example a svg? --- Comment by @zphoenixz on Dec 3, 2021 > It's probably a bug in the html backend mask impl. Can you share an example a svg? Perhaps, I noticed that this also happens when using ClipOval, in short; it doesn't clip at all xd --- Comment by @aytunch on Dec 8, 2021 For example this is one of the problematic svgs in html ``` <svg width="11" height="11" viewBox="0 0 11 11" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M5.25 0C6.6675 0 7.98 0.5775 8.9775 1.5225C9.9225 2.52 10.5 3.8325 10.5 5.25C10.5 8.1375 8.1375 10.5 5.25 10.5C2.3625 10.5 0 8.1375 0 5.25C0 2.3625 2.3625 0 5.25 0ZM4.51483 7.34981C4.6391 7.34981 4.70584 7.30985 4.80168 7.21421L7.78932 3.7365C7.94716 3.57433 7.87559 3.34051 7.66721 3.20188C7.49656 3.11567 7.29357 3.13593 7.1622 3.26701L4.45761 6.44726L3.25997 5.25214C3.11195 5.10443 2.88403 5.10443 2.73601 5.25214C2.588 5.39985 2.588 5.62729 2.73601 5.775L4.22799 7.26384L4.3159 7.30018C4.31708 7.30018 4.33641 7.30544 4.37605 7.31863C4.44831 7.34266 4.47456 7.34981 4.51483 7.34981Z" fill="#375FED"/> </svg> ``` --- Comment by @dnfield on Dec 8, 2021 But that SVG doesn't have masks... --- Comment by @aytunch on Dec 9, 2021 Then maybe the assumption of this problem being caused only by masks is wrong. --- Comment by @dnfield on Dec 9, 2021 Sure, but your example does not cause problems when I try it in a local demo in Chrome.
package,p: flutter_svg
low
Critical