Skip to content

Commit

Permalink
version 1.0.1
Browse files Browse the repository at this point in the history
## [1.0.1]
- more null safety migrations.
- experimental GDropShadowFilter.innerShadow (hurts performance).
- add SceneBuilderWidget.autoSize to auto expand the scene on the parent widget.
- fix bug with GText in `LayoutUtils.row`.
- fix `EventSignal` bug, remove() callbacks while dispatching them.
- prevents assigning `NaN` to GDisplayObject transform properties based on `double`.
- some minor fixes and forced non-nullable properties.
  • Loading branch information
roipeker committed Jun 1, 2021
1 parent 6e1fabc commit b8ce847
Show file tree
Hide file tree
Showing 86 changed files with 502 additions and 596 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [1.0.1]
- more null safety migrations.
- experimental GDropShadowFilter.innerShadow (hurts performance).
- add SceneBuilderWidget.autoSize to auto expand the scene on the parent widget.
- fix bug with GText in `LayoutUtils.row`.
- fix `EventSignal` bug, remove() callbacks while dispatching them.
- prevents assigning `NaN` to GDisplayObject transform properties based on `double`.
- some minor fixes and forced non-nullable properties.

## [1.0.0-nullsafety.0]
- initial migration to null-safety
- fix non-working examples.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To get some extended, boring explanations, and eventually some sample codes, che

#### news!

- WIP Support for [null-safety](https://github.com/roipeker/graphx/tree/null-safety)
- Support for [null-safety](https://github.com/roipeker/graphx/tree/null-safety)

- Support for HotReload

Expand Down
2 changes: 1 addition & 1 deletion example/lib/demos/breakout/scene/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ const kColorMap = {
3: Colors.orange,
2: Colors.green,
1: Colors.yellow,
};
};
1 change: 0 additions & 1 deletion example/lib/demos/demos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export 'murat_coffee/murat_coffee.dart';
export 'nico_loading_indicator/nico_loading_indicator.dart';
export 'nokia_snake/nokia_snake.dart';
export 'page_indicator/page_indicator.dart';
export 'path_chart_stress/path_chart_stress.dart';
export 'pie_chart/pie_chart.dart';
export 'pizza_box/pizza_box.dart';
export 'raster_draw/raster_draw.dart';
Expand Down
9 changes: 3 additions & 6 deletions example/lib/demos/drawing_pad_bezier/drawing_pad/bezier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import 'point.dart';

class BezierDraw {
static BezierDraw fromPoints(List<PadPoint> points, double w1, double w2) {
var c2 =
BezierDraw.controlPoints(points[0], points[1], points[2])[1];
var c3 =
BezierDraw.controlPoints(points[1], points[2], points[3])[0];
var c2 = BezierDraw.controlPoints(points[0], points[1], points[2])[1];
var c3 = BezierDraw.controlPoints(points[1], points[2], points[3])[0];
return BezierDraw(points[1], c2, c3, points[2], w1, w2);
}

static List<PadPoint> controlPoints(
PadPoint s1, PadPoint s2, PadPoint s3) {
static List<PadPoint> controlPoints(PadPoint s1, PadPoint s2, PadPoint s3) {
final dx1 = s1.x - s2.x;
final dy1 = s1.y - s2.y;
final dx2 = s2.x - s3.x;
Expand Down
4 changes: 1 addition & 3 deletions example/lib/demos/drawing_pad_bezier/drawing_pad_bezier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class DrawingPadBezierMain extends StatelessWidget {
children: [
SceneBuilderWidget(
builder: () => SceneController(
back: DrawPadScene(),
config: SceneConfig.tools
),
back: DrawPadScene(), config: SceneConfig.tools),
),
Positioned(left: 0, right: 0, bottom: 0, child: PadSettings()),
],
Expand Down
1 change: 0 additions & 1 deletion example/lib/demos/drawing_pad_bezier/pad_settings.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

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

Expand Down
1 change: 0 additions & 1 deletion example/lib/demos/dripping_iv/scene/svgs.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const tubeSvgString = '''
<svg width="64" height="193" viewBox="0 0 64 193" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="30" width="4" height="36" fill="#C4C4C4" fill-opacity="0.56"/>
Expand Down
8 changes: 3 additions & 5 deletions example/lib/demos/expander_fab_menu/expander_fab_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,14 @@ class MyCoolMenuScene extends GSprite {
button = MyButton();
}


void updatePosition(GRect position) {
button.x = position.x + position.width / 2;
buttonY = position.y + position.height / 2;
if( !isOpen ){
if (!isOpen) {
button.y = buttonY;
}
}


@override
void addedToStage() {
super.addedToStage();
Expand All @@ -159,10 +157,10 @@ class MyCoolMenuScene extends GSprite {
_buildMenu();
addChild(button);

stage!.onResized.add((){
stage!.onResized.add(() {
requestPositionCallback.call();
menuContainer.setPosition(sw / 2, sh / 2);
if( isOpen ){
if (isOpen) {
_renderCurt();
}
});
Expand Down
45 changes: 23 additions & 22 deletions example/lib/demos/fb_reactions/fb_reactions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,34 @@ class FacebookReactionsMain extends StatelessWidget {
appBar: AppBar(
centerTitle: false,
title: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16,),
filter: ImageFilter.blur(
sigmaX: 16,
sigmaY: 16,
),
child: Text(
'Facebook Reactions',
style: TextStyle(
color: _kBlue,
fontSize: 18,
fontWeight: FontWeight.bold,
color: _kBlue,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
backgroundColor: Colors.white.withOpacity(.6),
elevation: 0,
),
backgroundColor: Color(0xffebebeb),
body: SceneBuilderWidget(
builder: () => SceneController(front: MenuScene()),
child: Scrollbar(
child: ListView.separated(
padding: EdgeInsets.symmetric(vertical: 54, horizontal: 0),
separatorBuilder: (context, index) => const SizedBox(height: 8),
itemBuilder: (context, index) => InnerCardItem(data: posts[index]),
itemCount: posts.length,
),
),
),
backgroundColor: Colors.white.withOpacity(.6),
elevation: 0,
),
backgroundColor: Color(0xffebebeb),
body: SceneBuilderWidget(
builder: () => SceneController(front: MenuScene()),
child: Scrollbar(
child: ListView.separated(
padding: EdgeInsets.symmetric(vertical: 54, horizontal: 0),
separatorBuilder: (context, index) => const SizedBox(height: 8),
itemBuilder: (context, index) => InnerCardItem(data: posts[index]),
itemCount: posts.length,
)
,
)
,
)
,
);
}
}
Expand Down Expand Up @@ -80,6 +80,7 @@ class InnerCardItem extends StatelessWidget {
CircleAvatar(
backgroundColor: Colors.grey.withOpacity(.3),
radius: 24,

/// dev channel
// foregroundImage: NetworkImage(data.profileImageUrl),
child: Text(data!.username[0].toUpperCase()),
Expand Down
17 changes: 9 additions & 8 deletions example/lib/demos/fb_reactions/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ class PostVo {
);

static PostVo random() {
var vo = PostVo._(
var vo = PostVo._(
randomName(),
randomTitle(),
randomProfilePic(),
randomImage(),
randomTime(),
);
vo.numLikes=Math.randomRangeInt(2, 40);
vo.numComments=Math.randomRangeInt(1, 234);
vo.shares= '${Math.randomRangeInt(2, 500)} Shares';
vo.numLikes = Math.randomRangeInt(2, 40);
vo.numComments = Math.randomRangeInt(1, 234);
vo.shares = '${Math.randomRangeInt(2, 500)} Shares';
return vo;
}

Expand All @@ -87,10 +87,10 @@ class PostVo {
return 'https://randomuser.me/api/portraits/$value/$id.jpg';
}

static String randomTitle(){
static String randomTitle() {
var numWords = Math.randomRangeInt(5, 20);
var offset = Math.randomRangeInt(0, _kLoremWords.length-22);
var phrase = _kLoremWords.sublist(offset, offset+numWords).join(' ');
var offset = Math.randomRangeInt(0, _kLoremWords.length - 22);
var phrase = _kLoremWords.sublist(offset, offset + numWords).join(' ');
return phrase[0].toUpperCase() + phrase.substring(1);
}
}
Expand All @@ -101,4 +101,5 @@ Etiam nec malesuada dolor. Cras auctor malesuada lorem vitae mollis. Fusce odio
Morbi fringilla lacus nunc, at blandit odio eleifend sit amet. Suspendisse scelerisque bibendum hendrerit. Duis suscipit dictum massa, pharetra fermentum sapien placerat a. Integer gravida aliquam congue. Morbi maximus in mauris eu consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Nullam pulvinar massa eget pellentesque feugiat. Mauris interdum, massa et consequat tempus, neque nibh convallis odio, et tempus lorem erat eu quam. Maecenas condimentum dapibus orci, quis ultricies velit. Phasellus laoreet mattis elit eu facilisis. In id blandit nisl. Mauris posuere tellus in lectus ornare varius.
Vivamus nulla risus, mattis quis rutrum et, iaculis ut felis. Mauris lobortis dui vel metus dictum, eu auctor purus ullamcorper. Sed neque nulla, faucibus sed consequat in, rutrum sed felis. Suspendisse ut ligula dignissim, laoreet tellus sit amet, molestie eros. Nullam turpis tortor, rhoncus a nisi et, ornare euismod leo. Aliquam dictum, sapien et ultrices facilisis, quam orci interdum arcu, quis sodales sapien mauris non nibh. Aenean rutrum erat mi, at egestas neque vulputate a. Maecenas vel sollicitudin ipsum. Suspendisse varius tortor neque, vitae laoreet purus vulputate ut. Nulla pulvinar accumsan rhoncus.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vivamus et faucibus turpis. Duis maximus enim lacus, vitae commodo leo ultrices non. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Duis tristique quam in dolor rhoncus laoreet. Fusce malesuada sit amet augue non facilisis. Phasellus vitae molestie sapien. Duis egestas sem vitae vestibulum euismod. Nunc vulputate luctus ipsum, a aliquam eros maximus ac. Praesent sit amet luctus erat. Phasellus et eleifend ipsum, non placerat purus. Donec convallis a arcu eu aliquam. Nullam sagittis, diam ac porta sodales, purus dui aliquet nisl, nec lobortis mi ex id sapien. Pellentesque id faucibus purus, nec ultricies tortor.
'''.split(' ');
'''
.split(' ');
3 changes: 2 additions & 1 deletion example/lib/demos/feeling_switch/scene.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ class FeelingSwitch extends GSprite {
.endFill();

var smile = GShape();

/// for now, we avoid saving based on object bounds, as it will
/// crop the line edges.
smile.$useSaveLayerBounds = false ;
smile.$useSaveLayerBounds = false;
smile.graphics.lineStyle(
3,
Color(0xff71a745).withOpacity(.8),
Expand Down
16 changes: 8 additions & 8 deletions example/lib/demos/flower_gradient/scene.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ class FlowerScene extends GSprite {
GTween.delayedCall(
2,
() {
for (var i = 0; i < numLines; ++i) {
for (var i = 0; i < flower.numChildren; ++i) {
var j = numLines - i;
flower.children[i].tween(
duration: .6,
rotation: 0,
delay: j * .08,
// overwrite: 1,
ease: GEase.easeInBack,
);
flower.getChildAt(i).tween(
duration: .6,
rotation: 0,
delay: j * .08,
// overwrite: 1,
ease: GEase.easeInBack,
);
}
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class MyCurvyPath extends GraphicsClipper {
final curveSize = 60.0;
final targetW = size.width;
final targetH = size.height;
g.moveTo(0, curveSize)
g
.moveTo(0, curveSize)
.curveTo(0, 0, curveSize, 0)
.lineTo(targetW - curveSize, 0)
.curveTo(targetW, 0, targetW, -curveSize)
Expand Down
1 change: 0 additions & 1 deletion example/lib/demos/isma_chart/scene/chart_scene.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

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

Expand Down
1 change: 0 additions & 1 deletion example/lib/demos/isma_chart/widgets/orange_box.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:flutter/material.dart';

class OrangeBox extends StatelessWidget {
Expand Down
9 changes: 5 additions & 4 deletions example/lib/demos/mouse_repulsion/scene.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class MouseRepulsionScene extends GSprite {
var dy = d.y - my;
var dsq = dx * dx + dy * dy;
if (dsq < radiusSq) {
/// can't divide by 0
if (dsq == 0) {
dsq = 200;
}
var dist = Math.sqrt(dsq);
var tx = mx + dx / dist * radius;
var ty = my + dy / dist * radius;
Expand All @@ -87,10 +91,7 @@ class MouseRepulsionScene extends GSprite {
d.vy *= damp;
d.x += d.vx;
d.y += d.vy;
if (d.x.isNaN) d.x = 0;
if (d.y.isNaN) d.y = 0;
}

draw(container.graphics);
}

Expand Down Expand Up @@ -125,7 +126,7 @@ class MouseRepulsionScene extends GSprite {
}

class GraphPoint extends GShape {
double tx = 0, ty = 0, vx = 0, vy = 0;
double tx = 0, ty = 0, vx = 0.0, vy = 0.0;

GraphPoint() {
mouseEnabled = false;
Expand Down
3 changes: 1 addition & 2 deletions example/lib/demos/nico_loading_indicator/scene.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class CustomLoadingIndicatorSprite extends GSprite {

@override
void addedToStage() {

stage!.onResized.add((){
stage!.onResized.add(() {
x = stage!.stageWidth / 2;
y = stage!.stageHeight / 2;
});
Expand Down
2 changes: 1 addition & 1 deletion example/lib/demos/nokia_snake/game_scene.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class SnakeGameScene extends GSprite {
}

void onKeyDown(KeyboardEventData event) {
final key = event.rawEvent!.logicalKey;
final key = event.rawEvent.logicalKey;
if (key == Keys.LEFT_KEY) {
changeState(SnakeCommands.left);
}
Expand Down
1 change: 0 additions & 1 deletion example/lib/demos/nokia_snake/mobile_button_widget.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

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

Expand Down
1 change: 1 addition & 0 deletions example/lib/demos/page_indicator/scene.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class PageIndicatorPaged extends BaseScene {
dot.tween(
duration: .3,
alpha: targetAlpha,

/// for a zoom in effect
// scale: targetAlpha == 1 ? 1 : .25,
// y: targetAlpha == 1 ? 0.0 : dotSize / 2,
Expand Down
25 changes: 0 additions & 25 deletions example/lib/demos/path_chart_stress/path_chart_stress.dart

This file was deleted.

Loading

0 comments on commit b8ce847

Please sign in to comment.