bluemix / gradient-widgets Goto Github PK
View Code? Open in Web Editor NEWFlutter widgets wrapped with gradients
License: Apache License 2.0
Flutter widgets wrapped with gradients
License: Apache License 2.0
I tried using this package with my listview.but I am getting tons of errors .please help
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:gradient_app_bar/gradient_app_bar.dart';
import 'package:gradient_widgets/gradient_widgets.dart';
class RamList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return _myListView(context);
}
}
Widget _myListView(BuildContext context) {
final titles = [
'1.1st',
'2.2nd',
'3.3rd',
'4.4th',
'5.5th',
];
final numbers = [
'1 ',
'2 ',
'3 ',
'4 ',
'5 ',
];
class NamedGradient {
NamedGradient(this.gradient, this.name);
LinearGradient gradient;
String name;
}
List<NamedGradient> gradients = [
NamedGradient(Gradients.hotLinear, 'Hot Linear'),
NamedGradient(Gradients.jShine, 'J Shine'),
NamedGradient(Gradients.aliHussien, 'Golden Sunset'),
NamedGradient(Gradients.rainbowBlue, 'Rainbow'),
NamedGradient(Gradients.ali, 'Techno'),
NamedGradient(Gradients.cosmicFusion, 'Cosmic Fusion'),
NamedGradient(Gradients.backToFuture, 'Back to Future'),
NamedGradient(Gradients.blush, 'Blush'),
NamedGradient(Gradients.byDesign, 'By Design'),
NamedGradient(Gradients.coldLinear, 'Cold Linear'),
NamedGradient(Gradients.haze, 'Haze'),
NamedGradient(Gradients.hersheys, 'Hersheys'),
NamedGradient(Gradients.tameer, 'Tameer'),
NamedGradient(Gradients.taitanum, 'Taitanum'),
NamedGradient(Gradients.deepSpace, 'Deep Space'),
];
functionOne() {
Navigator.push(
context, new MaterialPageRoute(builder: (context) => new RamOne()));
}
functionTwo() {
Navigator.push(context, MaterialPageRoute(builder: (context) => RamTwo()));
}
functionThree() {
Navigator.push(
context, MaterialPageRoute(builder: (context) => RamThree()));
}
functionFour() {
Navigator.push(context, MaterialPageRoute(builder: (context) => RamFour()));
}
functionFive() {
Navigator.push(context, MaterialPageRoute(builder: (context) => RamFive()));
}
final List<Function> onTaps = [
functionOne,
functionTwo,
functionThree,
functionFour,
functionFive
];
return ListView.builder(
itemCount: titles.length,
itemBuilder: (context, index) {
return Card(
elevation: 10,
child: InkWell(
splashColor: Colors.green,
highlightColor: Colors.red,
child: Row(
children: <Widget>[
Container(
height: 100.0,
// width: 42.0,
//color: Colors.red,
),
Container(
margin: EdgeInsets.all(10),
child: Text(
numbers[index],
)),
Container(
height: 90.0,
width: 20.0,
color: Colors.blue,
),
//Container(color: colors[index],),
Container(
margin: EdgeInsets.all(10),
child: Text(titles[index]),
)
],
),
onTap: () => onTaps[index](),
));
});
//
// return ListView.builder(
// itemCount: titles.length,
// itemBuilder: (context, index) {
// return Card(
// color: Colors.black87,
// // <-- Card widget
// child: ListTile(
// title: Text(
// titles[index],
// style: TextStyle(
// fontSize: 18.0,
// color: Colors.white,
// fontWeight: FontWeight.w600,
// fontFamily: 'Patrick Hand'),
// ),
// onTap: () {
// onTaps[index]();
// },
// ),
// );
// },
// );
}
const String _r1 = """ ## step1
""";
class RamOne extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: GradientAppBar(
gradient: LinearGradient(
colors: [Colors.blue, Colors.purple, Colors.red])),
body: const Markdown(data: _r1)));
}
}
const String _ram2 = """
step-2
""";
class RamTwo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: new Scaffold(
appBar: GradientAppBar(
gradient: LinearGradient(
colors: [Colors.blue, Colors.purple, Colors.red])),
body: const Markdown(data: _ram2)));
}
}
const String _ram3 = """
step-3
""";
class RamThree extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: new Scaffold(
appBar: GradientAppBar(
gradient: LinearGradient(
colors: [Colors.blue, Colors.purple, Colors.red])),
body: const Markdown(data: _ram3)));
}
}
const String _ram4 = """
step4
""";
class RamFour extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: GradientAppBar(
gradient: LinearGradient(
colors: [Colors.blue, Colors.purple, Colors.red])),
body: const Markdown(data: _ram4)));
}
}
const String _ram5 = """
step5
""";
class RamFive extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: GradientAppBar(
gradient: LinearGradient(
colors: [Colors.blue, Colors.purple, Colors.red])),
body: const Markdown(data: _ram5)));
}
}
Is Icon going to be supported also for the gradient class as I think it will look very nice on apps.
I can't use a simple circular button as shown here:
CircularGradientButton(
child: Icon(Icons.add_location, size: 32.0),
callback: (){},
),
I's immediately throwing an error as listed and shown here:
A piece of the exception message
I/flutter (29912): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (29912): The following assertion was thrown building CircularGradientButton(dirty, dependencies:
I/flutter (29912): [_LocalizationsScope-[GlobalKey#36ec3], _InheritedTheme], state:
I/flutter (29912): _CircularGradientButtonState#a3b0e(ticker inactive)):
I/flutter (29912): 'package:flutter/src/material/floating_action_button.dart': Failed assertion: line 85 pos 15:
I/flutter (29912): 'elevation != null && elevation >= 0.0': is not true.
I/flutter (29912):
I/flutter (29912): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (29912): more information in this error message to help you determine and fix the underlying cause.
I/flutter (29912): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (29912): https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter (29912):
I/flutter (29912): When the exception was thrown, this was the stack:
I/flutter (29912): #2 new FloatingActionButton (package:flutter/src/material/floating_action_button.dart:85:15)
I/flutter (29912): #3 _CircularGradientButtonState.build (package:gradient_widgets/src/circular_gradient_button.dart:87:16)
I/flutter (29912): #4 StatefulElement.build (package:flutter/src/widgets/framework.dart:3825:27)
I/flutter (29912): #5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3736:15)
I/flutter (29912): #6 Element.rebuild (package:flutter/src/widgets/framework.dart:3559:5)
I/flutter (29912): #7 StatefulElement.update (package:flutter/src/widgets/framework.dart:3894:5)
I/flutter (29912): #8 Element.updateChild (package:flutter/src/widgets/framework.dart:2748:15)
I/flutter (29912): #9 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4601:32)
I think the out of the box experience could be better if the widgets would have a default gradients.
When the GradientButton put in Column and set the CrossAxisAlignment to stretch the GradientButton doesn't stretch like standard widgets, How we should set the width and height
Is AppBar going to be supported also for the gradient class as I think it will look very nice on apps.
That might be a good default behavior but there should be a dedicated background. Maybe a gradient as well - probably both
Any plans to upgrade to null-safety?
Hello, this isn't exactly an issue, but here we go.
Each time a GradientButton is drawn or pressed, i get a lot of opacity prints in the debug console. Is not a real problem, but a little annoying.
I/flutter (17286): _opacity.value: 0.0
I/flutter (17286): _opacity.value: 0.8630510419607162
I/flutter (17286): _opacity.value: 0.0
I/flutter (17286): _opacity.value: 0.7755804806947708
If I remove my GradientButton, this msg is not shown.
Sorry if I'm wrong or this is not the place.
It appears to be a bug when trying to set a shape to the GradientCard object.
When trying to set the shape an exception is thrown on:
package:gradient_widgets/src/gradient_card.dart:37:27
The message is:
"exception was thrown: type 'RoundedRectangleBorder' is not a subtype of type 'Decoration'"
Reading the code this makes sense to me since the required type of GradientCard is ShapeBorder, and is trying to pass it as to the decoration argument of Container which is of the type Decoration.
Initializing gradle... 0.7s
Resolving dependencies... 1.7s
Running 'gradlew assembleRelease'...
compiler message: file:///C:/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/gradient_widgets-0.3.0/lib/src/gradient_progress_indicator.dart:34:22: Error: A value of type 'dart.core::int' can't be assigned to a
variable of type 'dart.core::double'.
compiler message: Try changing the type of the left hand side, or casting the right hand side to 'dart.core::double'.
compiler message: double prevValue = 0;
compiler message: ^
Compiler terminated unexpectedly.
FAILURE: Build failed with an exception.
Where:
Script 'C:\FlutterSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 428
What went wrong:
Execution failed for task ':app:flutterBuildRelease'.
Process 'command 'C:\FlutterSDK\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 11s 12.3s
Gradle build failed: 1
How to enable ripple effect with CircularGradientButton widget?
/C:/Users/admin/AppData/Local/Pub/Cache/hosted/pub.dev/gradient_widgets-0.6.0/lib/src/gradient_widget.dart:104:73: Error: The getter 'button' isn't defined for the class 'TextTheme'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.