Skip to content

Instantly share code, notes, and snippets.

View tomasbaran's full-sized avatar
📱
developing a mobile app

Tomas Baran tomasbaran

📱
developing a mobile app
View GitHub Profile
@tomasbaran
tomasbaran / gist:c361be27eaf6df76c2d6429f2a83b9dd
Last active September 28, 2024 02:41
Simple ValueNotifier State Management Example
import 'package:flutter/material.dart';
import 'dart:math';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@tomasbaran
tomasbaran / gist:dd2e5014227383d0fe89b27e60ca194c
Created July 10, 2024 19:03
SoFiPacificMarqueePerformanceChange -> SoFiPacificMarqueePerformanceInfo
import 'package:flutter/material.dart';
import 'package:sofi_x_package/core/constants/dimensions.dart';
import 'package:sofi_x_package/core/themes/pacific/pacific_colors.dart';
import 'package:sofi_x_package/core/themes/sofi_theme.dart';
import 'package:sofi_x_package/widgets/pacific/loaders/pacific_loading_shimmer.dart';
import 'package:sofi_x_package/widgets/sofi_divider.dart';
import 'package:sofi_x_package/widgets/utilities/theme_container.dart';
/// Design Spec: https://www.figma.com/design/PV3yXSwydvnY2whzQO0pVG/Invest---Robo?node-id=3816-341443&t=pkroMz4fKn1cEQnK-4
class SoFiPacificMarqueePerformanceInfo extends StatelessWidget {
@tomasbaran
tomasbaran / main.dart
Last active April 3, 2024 22:17
isPalindrome
bool isPalindrome(int number) {
// Core logic explained on an example 1234
// 1234 == 4321
// old new
// Default values
// 1234 0
// Loop starts:
// 123 4 (0*10 +4)
// 12 43 (4*10+3)
// 1 432 (43*10 +2)
WEB CONFIG
flavor.dart:
```
import 'package:flutter/foundation.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:today/models/enums.dart';
@tomasbaran
tomasbaran / main.dart
Last active June 29, 2023 02:35
new-test
class RomanNumbers {
int romanCharToInt(String romanChar) {
switch (romanChar) {
case 'I':
return 1;
case 'V':
return 5;
case 'X':
return 10;
case 'L':
@tomasbaran
tomasbaran / main.dart
Created June 28, 2023 22:20
Amco challenge: romanToDecimalNumber
class RomanNumbers {
static int romanToDecimal(String romanNumber) {
Map<String, int> romanMap = {
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
'M': 1000,
@tomasbaran
tomasbaran / ANSI escape codes
Last active October 19, 2023 21:49
Colorize Debug Console Logs
Reset: \x1B[0m
Cursive: \x1B[3m // new data from db
Black: \x1B[30m
Red: \x1B[31m // errors
Green: \x1B[32m // manager/controller
Yellow: \x1B[33m // db data
Blue: \x1B[34m // flutter
Magenta: \x1B[35m
Cyan: \x1B[36m
White: \x1B[37m // local helper functions
@tomasbaran
tomasbaran / audio_file.dart
Created December 4, 2021 11:45
audio background not looping
import 'package:ambee2/models/animations/light_animation.dart';
import 'package:audio_service/audio_service.dart';
import 'package:flutter/material.dart';
// import 'package:just_audio/just_audio.dart';
import 'package:audioplayers/audioplayers.dart';
// Two lines below: this is how I call the audio to start
// await lightAnimation.audioHandler.setRepeatMode(AudioServiceRepeatMode.all);
// await lightAnimation.audioHandler.playUrl(lightAnimation.audioUrl, volumeSetValue);
@tomasbaran
tomasbaran / send_feedback.dart
Last active July 29, 2023 20:48
[Flutter template] Send Feedback Button
import 'package:flutter/material.dart';
import 'package:today/globals/constants.dart';
import 'package:today/services/auth_service.dart';
import 'package:today/style/style_constants.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'dart:io';
import 'package:flutter_email_sender/flutter_email_sender.dart';
import 'package:package_info_plus/package_info_plus.dart';
@tomasbaran
tomasbaran / fetch_list_of_jsons_api.dart
Last active May 13, 2020 10:29
[Flutter template] Fetch list of jsons api into your Flutter project.
// Call the method e.g. from initState like this: FetchListOfJsonsApi().getDecodedBody();
//
// Install the http plugin here: https://pub.dev/packages/http
import 'package:http/http.dart' as http;
import 'dart:convert';
class FetchListOfJsonsApi {
final String url;
FetchListOfJsonsApi({