Skip to content

Instantly share code, notes, and snippets.

View Ivy-Walobwa's full-sized avatar
💻
learning

Ivy-Walobwa Ivy-Walobwa

💻
learning
View GitHub Profile
class DownloadUtil {
static Future<String> downloadAndSaveFile(String url, String fileName) async {
final Directory directory = await getApplicationDocumentsDirectory();
final String filePath = '${directory.path}/$fileName.png';
final http.Response response = await http.get(Uri.parse(url));
final File file = File(filePath);
await file.writeAsBytes(response.bodyBytes);
return filePath;
}
@Ivy-Walobwa
Ivy-Walobwa / main.dart
Last active July 25, 2022 07:15
Flutter Local push notifications UI
import 'package:flutter/material.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@Ivy-Walobwa
Ivy-Walobwa / directions.dart
Last active June 6, 2022 05:15
Helpers for flutter flame game engine example. Creates the navigation keys for your app
enum Direction { up, down, left, right, none }
@Ivy-Walobwa
Ivy-Walobwa / router_delegate.dart
Last active October 13, 2023 07:23
Code snippets implementing RouteDelegate, RouteInformationParser and defining user data-types. Full repo here: https://github.com/Ivy-Walobwa/flutter_declarative_navigation
import 'package:flutter/material.dart';
import 'routes_config.dart';
import '../presentation/screens.dart';
import '../constants.dart';
class ShopListRouterDelegate extends RouterDelegate<ShopListRouteConfig>
with ChangeNotifier, PopNavigatorRouterDelegateMixin<ShopListRouteConfig> {
@override
final GlobalKey<NavigatorState> navigatorKey;
@Ivy-Walobwa
Ivy-Walobwa / ar.json
Last active March 1, 2022 05:08
Translation files
{
"appTitle": "المؤلفون",
"AlbertName": "ألبرت شفايتزر",
"AlbertBio": "كان ألبرت شفايتسر عالما موسعا في الألزاسي. كان عالمًا لاهوتيًا وعازفًا وكاتبًا وإنسانيًا وفيلسوفًا وطبيبًا.",
"AkhenatenName": "اخناتون",
"AkhenatenBio":"كان أخناتون ، المعروف قبل السنة الخامسة من حكمه أمنحتب الرابع ، فرعونًا مصريًا قديمًا من الأسرة الثامنة عشر ، وحكم لمدة 17 عامًا وتوفي ربما في عام 1336 قبل الميلاد أو 1334 قبل الميلاد."
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Firebase for Flutter Demo',
home: Scaffold(
body: StreamBuilder(
stream: FirebaseFirestore.instance.collection('places').snapshots(),
builder: ( BuildContext ctx, AsyncSnapshot<QuerySnapshot> snapshot){
@Ivy-Walobwa
Ivy-Walobwa / part1.md
Created June 8, 2020 14:06 — forked from vlandham/part1.md
Feature Branches and Pull Requests : Walkthrough

Here's a little walkthrough of how Yannick and I are using feature branches and pull requests to develop new features and adding them to the project. Below are the steps I take when working on a new feature. Hopefully this, along with watching the process on Github, will serve as a starting point to having everyone use a similar workflow.

Questions, comments, and suggestions for improvements welcome!

Start with the latest on master

When starting a new feature, I make sure to start with the latest and greatest codebase:

git checkout master
<h1>{{ data.title }}</h1>
<h2>{{ data.description }}</h2>
<p>{{ data.detail }}</p>
<label for="lang">Choose Language: </label>
<select id="lang" [formControl]="lang">
<option value="en" selected>English</option>
<option value="es">Spanish</option>
<option value="de">German </option>
<option value="ar">Arabic</option>
@Ivy-Walobwa
Ivy-Walobwa / index.html
Created December 10, 2019 20:31
SVG Animation with CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Happy Birthday</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
@Ivy-Walobwa
Ivy-Walobwa / app.component.css
Last active November 10, 2019 18:20
Rock Paper Scissors Game in Angular
.score-board{
margin: 20px auto;
border: 2px solid white;
color: white;
width: 200px;
border-radius: 4px;
text-align: center;
font-size: 46px;
padding: 15px 20px;
position: relative;