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
name: 'Telegram Action' | |
description: 'Telegram notification for workflow set up with GitHub Actions' | |
author: <name> | |
inputs: | |
botToken: | |
description: 'The Telegram Bot token' | |
required: true | |
chatId: | |
description: 'The target to which the message will be sent, can be a Telegram Channel or Group' | |
required: true |
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
{ | |
"scripts": { | |
"build": "tsc", | |
"clean": "rm -rf lib package-lock.json", | |
"rebuild": "yarn clean && yarn build", | |
"release": "yarn clean && yarn && yarn build && yarn npm-lock && mv -f package-lock.json npm.lock && rm -rf node_modules && yarn --prod && mv npm.lock package-lock.json", | |
"dev": "yarn clean && yarn", | |
"npm-lock": "synp -f -s yarn.lock" | |
} | |
} |
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
- name: notification | |
# uses: ./ # use relative path if this's the same repo of your action | |
uses: <user>/<repo>@v1 | |
with: | |
botToken: <TelegramBotToken> | |
chatId: <TelegramChatId> | |
jobStatus: ${{ job.status }} |
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
void main() => runApp(NotesApp()); | |
/// Root widget of the application. | |
class NotesApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) => StreamProvider.value( | |
initialData: CurrentUser.initial, | |
value: FirebaseAuth.instance.onAuthStateChanged.map((user) => CurrentUser.create(user)), | |
child: Consumer<CurrentUser>( | |
builder: (context, user, _) => MaterialApp( |
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
class CurrentUser { | |
final bool isInitialValue; | |
final FirebaseUser data; | |
const CurrentUser._(this.data, this.isInitialValue); | |
factory CurrentUser.create(FirebaseUser data) => CurrentUser._(data, false); | |
/// The inital empty instance. | |
static const initial = CurrentUser._(null, true); | |
} |
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
class LoginScreen extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() => _LoginScreenState(); | |
} | |
class _LoginScreenState extends State<LoginScreen> { | |
final _auth = FirebaseAuth.instance; | |
final _googleSignIn = GoogleSignIn(); | |
String _errorMessage; | |
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
class Note { | |
final String id; | |
String title; | |
String content; | |
Color color; | |
NoteState state; | |
final DateTime createdAt; | |
DateTime modifiedAt; | |
/// Instantiates a [Note]. |
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
/// Home screen, displays [Note] in a Grid or List. | |
class HomeScreen extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() => _HomeScreenState(); | |
} | |
class _HomeScreenState extends State<HomeScreen> { | |
bool _gridView = true; // `true` to show a Grid, otherwise a List. | |
@override |
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
class NotesGrid extends StatelessWidget { | |
final List<Note> notes; | |
final void Function(Note) onTap; | |
const NotesGrid({Key key, this.notes, this.onTap}) : super(key: key); | |
/// A static factory method can be used as a function reference | |
static NotesGrid create({Key key, this.notes, this.onTap}) => | |
NotesGrid(key: key, notes: notes, onTap: onTap); |
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
// The editor of a [Note], also shows every detail about a single note. | |
class NoteEditor extends StatefulWidget { | |
/// Create a [NoteEditor], | |
/// provides an existed [note] in edit mode, or `null` to create a new one. | |
const NoteEditor({Key key, this.note}) : super(key: key); | |
final Note note; | |
@override | |
State<StatefulWidget> createState() => _NoteEditorState(note); |