Coder Social home page Coder Social logo

saltyaom / niku Goto Github PK

View Code? Open in Web Editor NEW
366.0 5.0 14.0 2.61 MB

Compose Flutter UI from utilities Widget and extensions with dot cascade. Fluently developing without headache and Nested Hell.

Home Page: https://niku.saltyaom.com

License: Other

Kotlin 0.02% Swift 0.26% Objective-C 0.01% Dart 93.88% HTML 0.70% CMake 1.47% C++ 3.02% C 0.13% Ruby 0.50%
niku flutter widget

niku's Issues

NikuWrap throws an error when inserting different subtype class into its children.

When inserting Widget children through NikuWrap method, TypeErrorImpl will be thrown when the list subtype of NikuWrap constructor doesn't match with the subtype of the inserting child. Although _children property in NikuWrap constructor accepts any inherited Widget subtype.

Example

List<NikuColumn> someRandomColumnList = [1, 2, 3, 4].map((e) => NikuColumn(NikuText('$e'))).toList();
Container randomContainer = Container();

// This will throw an error. Expected a value of type 'NikuColumn', but got one of type 'Container'.
return NikuWrap(someRandomColumnList).insert(0, randomContainer);
// This also throw an error.
return NikuWrap(someRandomColumnList).append(randomContainer);

// But this will not.
return NIkuWrap(someRandomColumnList);
// This will not.
List<Widget> widgetList = someRandomColumnList.map((e) => e.build(context)).toList()
return NikuWrap(widgetList); // Build NikuColumn into generic `Widget` type first.
// This also not.
return NikuWrap(widgetList).append(randomContainer);

This might be an issue with dart forcing typecast into the parent subclass with assigning the _children property.

Bug Reusable Style: The widget of previous style are same with the last one

Bug Description

Widget content is being replaced with the last Widget which has the same applied style. This is happening after hot reload.

Video record

Kapture.2023-01-16.at.06.21.27.mp4

Expected

Previously styled widgets are not being replaced with the last Widget which shares the same style.

Example code

class RowStyle {
  static final labelInput = n.Row(const [])
    ..px = 15
    ..pb = 18
    ..pt = 10
    ..gap = 10;
}

class TextStyleNiku {
  static final labelInput = "".n
    ..mx = 15
    ..fontSize = 13;
}

// .....
  n.Column([
    "Jual / Beli:".n
      ..apply = TextStyleNiku.labelInput.copied, // first text style
    // .....
    "Kode saham:".n
      ..apply = TextStyleNiku.labelInput.copied, // last text style
// .....

Environment

sdk: '>=2.18.5 <3.0.0'
niku: ^2.3.3
flutter: 3.3.10

TextFormField Error

Please help, when i compile the app shows me a error, i use Flutter 3.16.0

hosted/pub.dev/niku-2.4.2/lib/widget/textFormField.dart:877:18: Error: The argument type 'bool?' can't be assigned to the parameter type 'bool' because 'bool?' is nullable and 'bool' isn't. enabled: enabled

Thanks.

Break on Flutter 3

Problem

Can't use Niku with the new Flutter 3.

Solution

Update to 2.3.0-experimental.2

Here's a screenshot of Niku with Flutter 3 running on Apple Silicon MacOS.
Screen Shot 2565-05-12 at 21 58 59

Detail:

I have no idea how or why Niku breaks on Flutter 3.
However, Niku 2.3 implemented an internal architecture rewrite known as Tempest Engine which for some reason doesn't break all the thing.

As it's a confirmed candidate for the next version of Niku and I have tested it a lot before publishing it as experimental, you should be able to use it without much breaking change (only 2 breaking changes which shouldn't affect a lot of people).

Also, I'll leave this issue open until the stable release of Niku 2.3.
So, yeah, if you encounter the problem and found a bug, feel free to report it by filing a new issue.

Unable to use expands method on NikuTextField

expands method on nikuTextField will throw assertion error when ran because maxLines and minLines property can't be set to null.

When build this

NikuTextField("yoyo")
    .expands()
    .niku()
    .height(200)
    .width(200),

will throws

The following assertion was thrown building Builder(dirty): 
Assertion failed:
!expands || (maxLines == null && minLines == null)
"minLines and maxLines must be null when expands is true."
...

So, The expected property would be,

NikuTextField("yoyo")
    .maxLines(null) // currently not nullable
    .minLines(null) // currently not nullable
    .expands()
    .niku()
    .height(200)
    .width(200),

Bug: conflict with Flutter 3.3.0

bug:

  • flutter pub get niku error with flutter 3.3.0.

env:

  • ✅ flutter 3.3.0
  • ✅ niku-2.3.2

The location of the error code:

niku-2.3.2/lib/widget/niku.dart:1048:25

error log:

../../../../../../.pub-cache/hosted/pub.flutter-io.cn/niku-2.3.2/lib/widget/niku.dart:1048:25: Error: The argument type 'BorderRadiusGeometry?' can't be assigned to the parameter type 'BorderRadius?'.
 - 'BorderRadiusGeometry' is from 'package:flutter/src/painting/border_radius.dart' ('../../../../../../.fvm/versions/3.3.0/packages/flutter/lib/src/painting/border_radius.dart').
 - 'BorderRadius' is from 'package:flutter/src/painting/border_radius.dart' ('../../../../../../.fvm/versions/3.3.0/packages/flutter/lib/src/painting/border_radius.dart').
          borderRadius: radius,
                        ^

Command PhaseScriptExecution failed with a nonzero exit code

NikuButton can't be disabled

The argument type 'void Function()?' can't be assigned to the parameter type 'void Function()'.

NikuButton can't be disabled because one can't pass "null" in onPressed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.