diff --git a/lib/routes/valueListenableBuilder.dart b/lib/routes/valueListenableBuilder.dart new file mode 100644 index 0000000..9c257bd --- /dev/null +++ b/lib/routes/valueListenableBuilder.dart @@ -0,0 +1,79 @@ +import 'package:fludget/Models/codeString.dart'; +import 'package:flutter/material.dart'; + +class ValueListenableBuilderImplementation extends StatelessWidget { + const ValueListenableBuilderImplementation({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final ValueNotifier _counter = ValueNotifier(0); + return MaterialApp( + theme: Theme.of(context), + home: Scaffold( + appBar: AppBar( + title: const Text('ValueListenableBuilder'), + ), + body: Center( + child: ValueListenableBuilder( + valueListenable: _counter, + builder: (context, value, child) { + return Text( + 'Value: $value', + style: const TextStyle(fontSize: 20), + ); + }, + ), + ), + floatingActionButton: FloatingActionButton( + child: const Icon(Icons.plus_one), + onPressed: () => _counter.value += 1, + ), + ), + ); + } +} + +class ValueListenableBuilderDescription extends StatelessWidget { + const ValueListenableBuilderDescription({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 22.0, left: 15, right: 15), + child: Text( + 'A widget whose content stays synced with a ValueListenable.', + style: TextStyle(fontSize: 20), + ), + ); + } +} + +class ValueListenableBuilderCode extends CodeString { + const ValueListenableBuilderCode(); + + @override + String buildCodeString() { + return """ValueListenableBuilderCode( + Scaffold( + appBar: AppBar( + title: const Text('ValueListenableBuilder'), + ), + body: Center( + child: ValueListenableBuilder( + valueListenable: _counter, + builder: (context, value, child) { + return Text( + 'Value: \$value', + style: const TextStyle(fontSize: 20), + ); + }, + ), + ), + floatingActionButton: FloatingActionButton( + child: const Icon(Icons.plus_one), + onPressed: () => _counter.value += 1, + ), + ), + """; + } +} diff --git a/lib/widgetList.dart b/lib/widgetList.dart index 1f614b8..696eaf1 100644 --- a/lib/widgetList.dart +++ b/lib/widgetList.dart @@ -106,6 +106,7 @@ import 'package:fludget/routes/timePickerDialog.dart'; import 'package:fludget/routes/cupertino_text_field.dart'; import 'package:fludget/routes/transform.dart'; import 'package:fludget/routes/togglebutton.dart'; +import 'package:fludget/routes/valueListenableBuilder.dart'; import 'package:fludget/routes/visibilityWidget.dart'; import 'package:fludget/routes/wrap.dart'; import 'package:fludget/routes/tooltip.dart'; @@ -1116,4 +1117,14 @@ const List widgets = [ category: [WidgetCategory.Animation], codeString: AnimatedSwitcherCode(), ), + WidgetModel( + name: "ValueListenableBuilder", + link: + "https://api.flutter.dev/flutter/widgets/ValueListenableBuilder-class.html", + subtitle: "A widget whose content stays synced with a ValueListenable.", + implementation: ValueListenableBuilderImplementation(), + description: ValueListenableBuilderDescription(), + category: [WidgetCategory.Interaction, WidgetCategory.Async], + codeString: ValueListenableBuilderCode(), + ), ]; diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 411af46..88b22e5 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST url_launcher_windows ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin)