Skip to content

Instantly share code, notes, and snippets.

@chibuezefelix
Created March 9, 2021 20:53
Show Gist options
  • Select an option

  • Save chibuezefelix/8d3b5d0727fec4cfedec75ff1136a653 to your computer and use it in GitHub Desktop.

Select an option

Save chibuezefelix/8d3b5d0727fec4cfedec75ff1136a653 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:expansion_tile_card/expansion_tile_card.dart';
import 'package:gitexpo/single-card.dart';
import 'package:gitexpo/utils/styles.dart';
void main() {
runApp(GitExpo());
}
class GitExpo extends StatelessWidget {
const GitExpo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primaryColor: Color(0xFF011627),
textTheme: TextTheme(bodyText1: TextStyle(color: Colors.white))),
home: Expos(),
);
}
}
class Expos extends StatefulWidget {
Expos({Key? key}) : super(key: key);
@override
_ExposState createState() => _ExposState();
}
class _ExposState extends State<Expos> {
final GlobalKey<ExpansionTileCardState> cardA = new GlobalKey();
final GlobalKey<ExpansionTileCardState> cardB = new GlobalKey();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).primaryColor,
title: Text(
"GitExpo",
style: Styles.appBarTitleText,
),
centerTitle: true,
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: ListView.builder(
itemCount: commands.length,
itemBuilder: (context, index) {
return
Padding(
padding: const EdgeInsets.only(top:8.0),
child: Singlecard(command: commands[index]),
);
})),
));
}
List<Command> commands = [
Command(content: "git init", title: "How to initialize a Git repo", subtitle: "Everything starts from here. The first step is to initialize a new Git repo locally in your project root. You can do so with the command below"),
Command(content: "git config -l", title: "How to check your Git configuration", subtitle: "The command below returns a list of information about your git configuration including user name and email"),
Command(content: "git config --global user.name 'Fabio'", title: "How to setup your Git username:", subtitle: "With the command below you can configure your user name"),
Command(content: "git config --global user.email 'mobiledev@chibuezefelix.com'", title: "How to setup your Git user email", subtitle: "This command lets you setup the user email address you'll use in your commits"),
Command(content: "git config --global credential.helper cache", title: "How to cache your login credentials in Git", subtitle: "You can store login credentials in the cache so you don't have to type them in each time. Just use this command"),
Command(content:"git add filename_here" , title: "How to add file to git", subtitle: "The command below will add a file to the staging area. Just replace filename_here with the name of the file you want to add to the staging area."),
Command(content:"git add ." , title: "How to add all files in the staging area in Git", subtitle: "If you want to add all files in your project to the staging area, you can use a wildcard . and every file will be added for you."),
Command(content:"git add fil*" , title: "How to add only certain files to the staging area in Git", subtitle: "With the asterisk in the command below, you can add all files starting with 'fil' in the staging area."),
Command(content: "git status", title: "How to check a repository's status in Git:", subtitle: "This command will show the status of the current repository including staged, unstaged, and untracked files."),
Command(content:"git commit" , title: "How to commit changes in the editor in Git:", subtitle: "This command will open a text editor in the terminal where you can write a full commit message.A commit message is made up of a short summary of changes, an empty line, and a full description of the changes after it."),
Command(content:"git commit -m 'your commit message here'" , title: "How to commit changes with a message in Git:", subtitle: "You can add a commit message without opening the editor. This command lets you only specify a short summary for your commit message."),
Command(content: "git commit -a -m 'your commit message here'", title: "How to commit changes (and skip the staging area) in Git:", subtitle: "You can add and commit tracked files with a single command by using the -a and -m options."),
Command(content: "git log", title: "How to see your commit history in Git:", subtitle: "This command shows the commit history for the current repository"),
];
import 'package:flutter/material.dart';
import 'package:expansion_tile_card/expansion_tile_card.dart';
import 'package:gitexpo/utils/styles.dart';
import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart';
class Singlecard extends StatefulWidget {
final Command command;
Singlecard(
{Key? key,
required this.command
})
: super(key: key);
@override
_SinglecardState createState() => _SinglecardState();
}
class _SinglecardState extends State<Singlecard> {
final GlobalKey<ExpansionTileCardState> cardA = new GlobalKey();
var uuid = Uuid();
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: ExpansionTileCard(
baseColor: Styles.cardExpandedColor,
expandedColor: Styles.cardExpandedColor,
expandedTextColor: Styles.cardTextExpandBaseColor,
key: UniqueKey(),
title: Text(
widget.command. title,
style: Styles.cardTitleText,
overflow: TextOverflow.ellipsis,maxLines: 2
),
children: <Widget>[
Divider(
thickness: 1.0,
height: 1.0,
),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 8.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(widget.command.subtitle,style:Styles.cardBodyText,overflow: TextOverflow.ellipsis,maxLines: 3,),
SizedBox(height: 13,),
Text(
"""${widget.command.content}""",
style: Styles.cardContentText,
),
],
),
),
),
],
),
);
}
}
class Command {
final String title;
final String subtitle;
final String content;
Command({
required this.content,
required this.title,
required this.subtitle,
});
}
import 'package:flutter/material.dart';
class Styles {
static const cardTitleText = TextStyle(color: Colors.white, fontSize: 16,fontWeight: FontWeight.bold);
static const cardBodyText = TextStyle(color: Colors.white, fontSize: 11,fontWeight: FontWeight.normal);
static const cardContentText = TextStyle(color: Colors.redAccent, fontSize: 9,fontWeight: FontWeight.normal);
static const appBarTitleText = TextStyle(color: Colors.white, fontSize: 16);
static const cardBaseColor = Color(0xFFAEB7B3);
static const cardExpandedColor = Color(0xFF171219);
static const cardTextExpandBaseColor = Color(0xFFFFFFFF);
//#BUTTONS
static ButtonStyle flatButtonStyle = TextButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
),
);
}
import 'package:flutter/material.dart';
import 'package:expansion_tile_card/expansion_tile_card.dart';
import 'package:gitexpo/single-card.dart';
import 'package:gitexpo/utils/styles.dart';
void main() {
runApp(GitExpo());
}
class GitExpo extends StatelessWidget {
const GitExpo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primaryColor: Color(0xFF011627),
textTheme: TextTheme(bodyText1: TextStyle(color: Colors.white))),
home: Expos(),
);
}
}
class Expos extends StatefulWidget {
Expos({Key? key}) : super(key: key);
@override
_ExposState createState() => _ExposState();
}
class _ExposState extends State<Expos> {
final GlobalKey<ExpansionTileCardState> cardA = new GlobalKey();
final GlobalKey<ExpansionTileCardState> cardB = new GlobalKey();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).primaryColor,
title: Text(
"GitExpo",
style: Styles.appBarTitleText,
),
centerTitle: true,
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: ListView.builder(
itemCount: commands.length,
itemBuilder: (context, index) {
return
Padding(
padding: const EdgeInsets.only(top:8.0),
child: Singlecard(command: commands[index]),
);
})),
));
}
List<Command> commands = [
Command(content: "git init", title: "How to initialize a Git repo", subtitle: "Everything starts from here. The first step is to initialize a new Git repo locally in your project root. You can do so with the command below"),
Command(content: "git config -l", title: "How to check your Git configuration", subtitle: "The command below returns a list of information about your git configuration including user name and email"),
Command(content: "git config --global user.name 'Fabio'", title: "How to setup your Git username:", subtitle: "With the command below you can configure your user name"),
Command(content: "git config --global user.email 'mobiledev@chibuezefelix.com'", title: "How to setup your Git user email", subtitle: "This command lets you setup the user email address you'll use in your commits"),
Command(content: "git config --global credential.helper cache", title: "How to cache your login credentials in Git", subtitle: "You can store login credentials in the cache so you don't have to type them in each time. Just use this command"),
Command(content:"git add filename_here" , title: "How to add file to git", subtitle: "The command below will add a file to the staging area. Just replace filename_here with the name of the file you want to add to the staging area."),
Command(content:"git add ." , title: "How to add all files in the staging area in Git", subtitle: "If you want to add all files in your project to the staging area, you can use a wildcard . and every file will be added for you."),
Command(content:"git add fil*" , title: "How to add only certain files to the staging area in Git", subtitle: "With the asterisk in the command below, you can add all files starting with 'fil' in the staging area."),
Command(content: "git status", title: "How to check a repository's status in Git:", subtitle: "This command will show the status of the current repository including staged, unstaged, and untracked files."),
Command(content:"git commit" , title: "How to commit changes in the editor in Git:", subtitle: "This command will open a text editor in the terminal where you can write a full commit message.A commit message is made up of a short summary of changes, an empty line, and a full description of the changes after it."),
Command(content:"git commit -m 'your commit message here'" , title: "How to commit changes with a message in Git:", subtitle: "You can add a commit message without opening the editor. This command lets you only specify a short summary for your commit message."),
Command(content: "git commit -a -m 'your commit message here'", title: "How to commit changes (and skip the staging area) in Git:", subtitle: "You can add and commit tracked files with a single command by using the -a and -m options."),
Command(content: "git log", title: "How to see your commit history in Git:", subtitle: "This command shows the commit history for the current repository"),
];
import 'package:flutter/material.dart';
import 'package:expansion_tile_card/expansion_tile_card.dart';
import 'package:gitexpo/utils/styles.dart';
import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart';
class Singlecard extends StatefulWidget {
final Command command;
Singlecard(
{Key? key,
required this.command
})
: super(key: key);
@override
_SinglecardState createState() => _SinglecardState();
}
class _SinglecardState extends State<Singlecard> {
final GlobalKey<ExpansionTileCardState> cardA = new GlobalKey();
var uuid = Uuid();
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: ExpansionTileCard(
baseColor: Styles.cardExpandedColor,
expandedColor: Styles.cardExpandedColor,
expandedTextColor: Styles.cardTextExpandBaseColor,
key: UniqueKey(),
title: Text(
widget.command. title,
style: Styles.cardTitleText,
overflow: TextOverflow.ellipsis,maxLines: 2
),
children: <Widget>[
Divider(
thickness: 1.0,
height: 1.0,
),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 8.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(widget.command.subtitle,style:Styles.cardBodyText,overflow: TextOverflow.ellipsis,maxLines: 3,),
SizedBox(height: 13,),
Text(
"""${widget.command.content}""",
style: Styles.cardContentText,
),
],
),
),
),
],
),
);
}
}
class Command {
final String title;
final String subtitle;
final String content;
Command({
required this.content,
required this.title,
required this.subtitle,
});
}
import 'package:flutter/material.dart';
class Styles {
static const cardTitleText = TextStyle(color: Colors.white, fontSize: 16,fontWeight: FontWeight.bold);
static const cardBodyText = TextStyle(color: Colors.white, fontSize: 11,fontWeight: FontWeight.normal);
static const cardContentText = TextStyle(color: Colors.redAccent, fontSize: 9,fontWeight: FontWeight.normal);
static const appBarTitleText = TextStyle(color: Colors.white, fontSize: 16);
static const cardBaseColor = Color(0xFFAEB7B3);
static const cardExpandedColor = Color(0xFF171219);
static const cardTextExpandBaseColor = Color(0xFFFFFFFF);
//#BUTTONS
static ButtonStyle flatButtonStyle = TextButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment