Last active
February 18, 2022 13:36
-
-
Save aryzae/9e57bf8b8d97418ef80b2e8890fe63bd to your computer and use it in GitHub Desktop.
クレしんのFlutter版
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
// 以下の整理&最近使う方法での書き方 | |
// https://gist.github.com/sho-ito-1027/a5887ca05bb5884719dfdc281a799777 | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class Colors { | |
const Colors._(); | |
static const topColor = Color(0xFFF183A4); | |
static const bottomColor = Color(0xFFF3F380); | |
static const titleColor = Color(0xFF61035F); | |
} | |
class TextStyles { | |
const TextStyles._(); | |
static const TextStyle _default = TextStyle( | |
color: Colors.titleColor, | |
); | |
static TextStyle title3 = _default.copyWith(fontSize: 20.0); | |
static TextStyle caption2 = _default.copyWith(fontSize: 11.0); | |
} | |
extension TextStyleExt on TextStyle { | |
TextStyle bold() => copyWith(fontWeight: FontWeight.w800); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'クレヨンしんちゃん', | |
home: Scaffold( | |
body: Center( | |
child: Container( | |
padding: const EdgeInsets.all(16.0), | |
width: 400, | |
height: 300, | |
decoration: const BoxDecoration( | |
gradient: LinearGradient( | |
begin: Alignment.topCenter, | |
end: Alignment.bottomCenter, | |
colors: <Color>[Colors.topColor, Colors.bottomColor]), | |
), | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Text( | |
"かいはつとちゅう", | |
style: TextStyles.caption2, | |
), | |
Text( | |
"開発途中で", | |
style: TextStyles.title3.bold(), | |
), | |
], | |
), | |
Padding( | |
padding: const EdgeInsets.only(left: 32), | |
child: Text( | |
"だいたいプレビュー使わなくなるゾ", | |
textAlign: TextAlign.end, | |
style: TextStyles.title3.bold(), | |
), | |
), | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Author
aryzae
commented
Feb 18, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment