This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import androidx.compose.foundation.Image | |
| import androidx.compose.foundation.layout.Row | |
| import androidx.compose.foundation.layout.padding | |
| import androidx.compose.foundation.layout.preferredSize | |
| import androidx.compose.material.MaterialTheme | |
| import androidx.compose.material.Text | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.Alignment | |
| import androidx.compose.ui.Modifier | |
| import androidx.compose.ui.graphics.ColorFilter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import androidx.compose.Composable | |
| import androidx.ui.core.Modifier | |
| import androidx.ui.core.tag | |
| import androidx.ui.foundation.Text | |
| import androidx.ui.foundation.drawBackground | |
| import androidx.ui.graphics.Color | |
| import androidx.ui.layout.ConstraintLayout | |
| import androidx.ui.layout.ConstraintSet | |
| import androidx.ui.layout.fillMaxWidth | |
| import androidx.ui.layout.padding |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Persistence.kt will end up looking like this after exercises 1 and 2. | |
| fun stubPersistence(defaultAccounts: List<User>? = null, pool: CoroutineContext = IOPool) = | |
| object : AccountPersistence { | |
| private var accounts = defaultAccounts ?: emptyList() | |
| private lateinit var updateTrigger: () -> Unit | |
| override fun loadAccountsFromDatabase(): Stream<List<User>> = Stream( | |
| Stream.async { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'FabLoader Demo', | |
| theme: ThemeData( | |
| primarySwatch: Colors.blue, | |
| ), | |
| home: Scaffold( | |
| appBar: AppBar( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _FabLoadingWidget extends State<FabLoader> | |
| with SingleTickerProviderStateMixin { | |
| final Widget child; | |
| final double strokeWidth; | |
| AnimationController _controller; | |
| _FabLoadingWidget({@required this.strokeWidth, @required this.child}); | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final Animatable<double> _kRotationTween = CurveTween(curve: const SawTooth(5)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final Animatable<int> _kStepTween = StepTween(begin: 0, end: 5); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final Animatable<double> _kStrokeTailTween = CurveTween( | |
| curve: const Interval(0.5, 1.0, curve: Curves.fastOutSlowIn), | |
| ).chain(CurveTween( | |
| curve: const SawTooth(5), | |
| )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final Animatable<double> _kStrokeHeadTween = CurveTween( | |
| curve: const Interval(0.0, 0.5, curve: Curves.fastOutSlowIn), | |
| ).chain(CurveTween( | |
| curve: const SawTooth(5), | |
| )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ArcPainter extends CustomPainter { | |
| // ... | |
| @override | |
| void paint(Canvas canvas, Size size) { | |
| if (backgroundColor != null) { | |
| final Paint backgroundPaint = Paint() | |
| ..color = backgroundColor | |
| ..strokeWidth = strokeWidth | |
| ..style = PaintingStyle.stroke; |
NewerOlder