{"id":18069141,"url":"https://github.com/arcticfox1919/flutter_lua_dardo","last_synced_at":"2025-04-11T23:43:58.169Z","repository":{"id":45886194,"uuid":"321432973","full_name":"arcticfox1919/flutter_lua_dardo","owner":"arcticfox1919","description":"This is an extension of the LuaDardo library.LuaDardo library allows Flutter to execute Lua scripts, and this library which mainly wraps some of Flutter's interfaces, which gives Flutter the ability to dynamically update and generate interfaces using remote scripts in places where UI styles need to be changed frequently.","archived":false,"fork":false,"pushed_at":"2021-11-29T20:16:48.000Z","size":33,"stargazers_count":42,"open_issues_count":2,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-11T23:43:54.446Z","etag":null,"topics":["dart","flutter","lua","luadardo"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arcticfox1919.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-14T18:09:14.000Z","updated_at":"2025-01-11T23:26:41.000Z","dependencies_parsed_at":"2022-09-05T05:20:22.596Z","dependency_job_id":null,"html_url":"https://github.com/arcticfox1919/flutter_lua_dardo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcticfox1919%2Fflutter_lua_dardo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcticfox1919%2Fflutter_lua_dardo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcticfox1919%2Fflutter_lua_dardo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcticfox1919%2Fflutter_lua_dardo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arcticfox1919","download_url":"https://codeload.github.com/arcticfox1919/flutter_lua_dardo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248497894,"owners_count":21113983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","flutter","lua","luadardo"],"created_at":"2024-10-31T08:09:26.069Z","updated_at":"2025-04-11T23:43:58.148Z","avatar_url":"https://github.com/arcticfox1919.png","language":"Dart","readme":"# flutter_lua_dardo\n\nThis is an extension of the [LuaDardo](https://github.com/arcticfox1919/LuaDardo) library.LuaDardo library allows Flutter to execute Lua scripts, and this library which mainly wraps some of Flutter's interfaces, which gives Flutter the ability to dynamically update and generate interfaces using remote scripts in places where UI styles need to be changed frequently.\n\nPlease note that this is an experimental exploration. It only encapsulates a few simple Widgets. Others are welcome to encapsulate more Widgets for Lua.\n\n![](https://gitee.com/arcticfox1919/ImageHosting/raw/master/img/GIF_2021-5-11_21-44-49.gif)\n\n## Usage\n\nNew Lua script `test.lua`:\n\n\n```lua\nfunction getContent1()\n    return Row:new({\n        children={\n            GestureDetector:new({\n                onTap=function()\n                    flutter.debugPrint(\"--------------onTap--------------\")\n                end,\n\n                child=Text:new(\"click here\")}),\n            Text:new(\"label1\"),\n            Text:new(\"label2\"),\n            Text:new(\"label3\"),\n        },\n        mainAxisAlign=MainAxisAlign.spaceEvenly,\n    })\nend\n\nfunction getContent2()\n    return Column:new({\n        children={\n            Row:new({\n                children={Text:new(\"Hello\"),Text:new(\"Flutter\")},\n                mainAxisAlign=MainAxisAlign.spaceAround\n            }),\n            Image:network('https://gitee.com/arcticfox1919/ImageHosting/raw/master/img/flutter_lua_test.png'\n                ,{fit=BoxFit.cover})\n        },\n        mainAxisSize=MainAxisSize.min,\n        crossAxisAlign=CrossAxisAlign.center\n    })\nend\n```\n\nIn your Flutter project, add the dependency. `pubspec.yaml`\n\n```yaml\ndependencies:\n  flutter_lua_dardo: ^0.0.2\n```\n\nAdd Dart code:\n\n```dart\nclass _MyHomePageState extends State\u003cMyHomePage\u003e {\n  LuaState _ls;\n  bool isChange = false;\n    \n  @override\n  void initState() {\n    loadLua();\n    super.initState();\n  }\n    \n  void loadLua() async {\n    String src = await rootBundle.loadString('assets/test.lua');\n    try {\n      LuaState ls = LuaState.newState();\n      ls.openLibs();\n      FlutterLua.open(ls);\n      FlutterWidget.open(ls);\n      ls.doString(src);\n      setState(() {\n        _ls = ls;\n      });\n    } catch (e) {\n      print(e);\n    }\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: Container(\n        alignment: Alignment.center,\n        child: _ls == null\n            ? CircularProgressIndicator()\n             // call the specified Lua function\n            : FlutterWidget.findViewByName\u003cWidget\u003e(\n            _ls, isChange ? \"getContent2\" : \"getContent1\"),\n      ),\n      floatingActionButton: FloatingActionButton(\n        child: Icon(CupertinoIcons.arrow_swap),\n        onPressed: (){\n          setState(() {\n            isChange = !isChange;\n          });\n        },\n      ),\n    );\n  }\n}\n```\n\n**To learn how to bind the Dart class to Lua, you can view this [example](https://github.com/arcticfox1919/flutter_lua_dardo/tree/master/test).**\n\nFor usage of LuaDardo, see [here](https://github.com/arcticfox1919/libd/blob/main/README.md).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcticfox1919%2Fflutter_lua_dardo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farcticfox1919%2Fflutter_lua_dardo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcticfox1919%2Fflutter_lua_dardo/lists"}