在onTap触发时将滤色器添加到图像

时间:2019-09-11 18:20:00

标签: flutter dart

我有一个带有一些图像的GridView。如果GestureDetector检测到onTap事件,我希望图像应用ColorFilter。我得到了整个imageList,但是我只希望单击的图像可以应用ColorFilter。有办法吗?

class _StateFullConsumerWidgetState<T extends ChangeNotifier> 
    extends State<StateFullConsumerWidget<T>>

编辑:

struct SettingsFont: View {

    @EnvironmentObject var userSettings: UserSettings

    let fontNames = FontName.allCases

    var body: some View {
        NavigationView {
            Form {
                Section {
                    Picker(selection: $userSettings.fontName, label: Text("Font Type")) {
                        ForEach(fontNames, id: \.self) { fontName in
                            Text(fontName.rawValue).tag(fontName.rawValue)
                                .font(FontFactory.noteFont(for: fontName))
                        }
                    }
                }
            }
        }
        .navigationBarTitle(Text("Font"))
    }

}

0 个答案:

没有答案