Color gradients take a starting color and position and ending color and position. Then it performs a transition between the colors. With consideration for color theory, they can make an application more visually interesting than a plain design. |
import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, ), home: MyHomePage(), ); } } class MyHomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Flutter Gradient Example'), ), body: Center( child: Container( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ Colors.blue, Colors.red, Colors.green, Colors.yellow ], ) ), child: Center( child: Text( 'Hello Gradient!', style: TextStyle( fontSize: 48.0, fontWeight: FontWeight.bold, color: Colors.white, ), ), ), ), ), ); } } |
Compile your code and have it run in an emulator: This creates a linear gradient that starts at 0.0 of the way down the screen with blue then red then green and last yellow. |
Showing posts with label flush. Show all posts
Showing posts with label flush. Show all posts
Wednesday, September 28, 2022
How To Use Gradients in Flutter with BoxDecoration and GradientAppBar
Wednesday, August 3, 2016
Grails track hibernate transaction begin, flush, commit and rollback status
Package: org.springframework.orm.hibernate4
Class: HibernateTransactionManager
Wednesday, October 23, 2013
Duplicated records/data persistence/flush session error with Grails in synchronized method
Consider some of cases:
- When domain fails to save data because of duplicate record.
- When an unsaved domain belongsTo a domain, then showing: 'save the transient instance before flushing'.
Here is example of my thread creation:
Thread.start {
Domain.withTransaction {
// Doing stuff and calling synchronization method to write data to DB
}
}
Fix was found here: Grails, GPars and data persistenceI replaced "Domain.withTransaction" with "Domain.withNewSession":
Thread.start {
Domain.withNewSession {
// Doing stuff and calling synchronization method to write data to DB
}
}
and save(flush:true) start writing into mySQL. Since data is written
to mySQL, findBy... start returning proper results and therefore I
application doesn't try to create duplicated record anymore. Issue
solved!
Subscribe to:
Posts (Atom)