-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b881c6
commit 3d32592
Showing
6 changed files
with
91 additions
and
26 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'dart:ui' as ui; | ||
|
||
|
||
import '../theme/customTheme.dart'; | ||
|
||
class GameLogo extends StatefulWidget { | ||
final Size size; | ||
|
||
const GameLogo({super.key, required this.size}); | ||
|
||
@override | ||
State<GameLogo> createState() => _GameLogoState(); | ||
} | ||
|
||
class _GameLogoState extends State<GameLogo> { | ||
late Future<ui.Image> _img; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_img = rootBundle.load("assets/images/desperado.png") | ||
.then((bytes) => decodeImageFromList(bytes.buffer.asUint8List())); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return FutureBuilder( | ||
future: _img, | ||
builder: (context, snapshot) { | ||
if (!snapshot.hasData) | ||
return SizedBox( | ||
width: widget.size.width, | ||
height: widget.size.height, | ||
); | ||
return ShaderMask( | ||
blendMode: BlendMode.dstIn, | ||
shaderCallback: (bounds) { | ||
var image = snapshot.data!; | ||
return ImageShader( | ||
image, | ||
TileMode.repeated, | ||
TileMode.repeated, | ||
Matrix4.diagonal3Values(widget.size.width / image.width, widget.size.height / image.height, 1).storage, | ||
); | ||
}, | ||
child: Padding( | ||
padding: const EdgeInsets.all(1), | ||
child: Container( | ||
width: widget.size.width - 1, | ||
height: widget.size.height - 1, | ||
color: getTheme(context).textColor?.withOpacity(0.85), | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains 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
This file contains 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