shared_preferences_settings icon indicating copy to clipboard operation
shared_preferences_settings copied to clipboard

How I can use onStringChanged with RadioPickerSettingsTile

Open nodermann2 opened this issue 5 years ago • 6 comments

I can't figure out where to add the function to get data. Could you provide a full example?

nodermann2 avatar Apr 11 '20 09:04 nodermann2

I need to get a change event to call notifyListeners()

nodermann2 avatar Apr 11 '20 10:04 nodermann2

See #11 and readme for example.

barnabasbartha avatar Apr 11 '20 13:04 barnabasbartha

Yes, I saw it I believe a full-fledged example would be better because #11 is also given an incomplete answer. How do I change this code so that the void selected(String item) method is called every time the user changes the value?

import 'package:flutter/material.dart';
import 'package:shared_preferences_settings/shared_preferences_settings.dart';

class MyScreen extends StatelessWidget {
  const MyScreen({Key key}) : super(key: key);

  void selected(String item) {
    print('selected: $item');
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: RadioPickerSettingsTile(
        settingKey: 'hello-key',
        title: 'Welcome',
        values: {
          'a': 'Hello',
          'b': 'World',
        },
      ),
    );
  }
}

nodermann2 avatar Apr 11 '20 17:04 nodermann2

I see. Unfortunately, this is not supported atm. I'll add an onChange callback parameter soon.

barnabasbartha avatar Apr 11 '20 17:04 barnabasbartha

I see. Unfortunately, this is not supported atm. I'll add an onChange callback parameter soon.

Any news?

koteezy avatar Apr 21 '20 11:04 koteezy

I see. Unfortunately, this is not supported atm. I'll add an onChange callback parameter soon.

Any news?

I didn't wait and made my own implementation without this dependency.

nodermann2 avatar Apr 21 '20 12:04 nodermann2