Skip to content

Instantly share code, notes, and snippets.

@kostapappas
Last active July 4, 2019 16:26
Show Gist options
  • Save kostapappas/135c3468821f6d222591829200b8ae0a to your computer and use it in GitHub Desktop.
Save kostapappas/135c3468821f6d222591829200b8ae0a to your computer and use it in GitHub Desktop.
basic flutter UI
new Container(
padding: new EdgeInsets.all(8.0),
height: 250.0,
child: textExample,
)
final row = new Row(
children: <Widget>[
textExample,
textExample,
textExample
],
)
final column = new Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
textExample,
textExample
],
)
final stackOfItems = new Stack(
children: <Widget>[
backgroundImage,
onTopContent
],
)
//RED Line
final redLine = new Container(
height: 2.0,
width: 150.0,
color: Colors.redAccent,
)
//In the declarative style, view configurations (such as Flutter’s Widgets)
//are immutable and are only lightweight “blueprints”.
//To change the UI, a Widget triggers a rebuild on itself
//(most commonly by calling setState() on StatefulWidgets
//in Flutter) and constructs a new Widget subtree.
//BLANK APP
import 'package:flutter/material.dart';
//BLANK APP
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: new FirstScreen(), //calling chat_screen_item.dart
);
}
}
class FirstScreen extends StatelessWidget{
final textExample = new Text("example",
style: new TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 16.0,
backgroundColor: Colors.red,
),);
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Chat Item"),
backgroundColor: Colors.lightGreen,
),
body: textExample, //calling chat_item.dart
);
}
}
import 'package:flutter/material.dart';
final baseTextStyle = const TextStyle(
color: Colors.white,
fontFamily: 'arial'
);
final bigHeaderTextStyle = baseTextStyle.copyWith(
fontSize: 20.0,
fontWeight: FontWeight.bold,
);
final descTextStyle = baseTextStyle.copyWith(
fontSize: 12.0,
fontWeight: FontWeight.w400,
);
final footerTextStyle = baseTextStyle.copyWith(
fontSize: 10.0,
fontWeight: FontWeight.w400,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment