Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working

Ivan Terekhin JEuler

🏠
Working
View GitHub Profile
View string2json.py
import json
import stringcase
from xml.dom import minidom
xmldoc = minidom.parse('strings.xml')
itemlist = xmldoc.getElementsByTagName('string')
with open('strings.json', 'w', encoding='utf8') as out_file:
out_file.write('{')
for s in itemlist:
@JEuler
JEuler / circle_button.dart
Last active Apr 23, 2020
Button with a circle shape
View circle_button.dart
import 'package:flutter/material.dart';
/// Button that have a circle shape
class CircleButton extends StatelessWidget {
// ignore: public_member_api_docs
const CircleButton(
{Key key,
this.onTap,
this.child,
this.size,
@JEuler
JEuler / user_store.dart
Created Apr 1, 2020
MobX Flutter store example
View user_store.dart
part 'user_store.g.dart';
/// User Store
class UserStore = UserStoreBase with _$UserStore;
/// User Store
abstract class UserStoreBase with Store {
final WebService _webService;
final StorageService _storageService;
@JEuler
JEuler / web_service.dart
Created Apr 1, 2020
WebService example
View web_service.dart
import 'dart:async';
import 'dart:io';
import 'package:built_collection/built_collection.dart';
import 'package:chopper/chopper.dart';
import 'package:flutter_translate/flutter_translate.dart';
import 'package:get/get.dart' as get_lib;
import 'package:http/io_client.dart' as http;
import '../model/user.dart';
@JEuler
JEuler / storage_service_impl.dart
Created Mar 15, 2020
Hive StorageService implementation example
View storage_service_impl.dart
import 'package:hive/hive.dart';
import '../model/local/db_user.dart';
import '../model/user.dart';
import 'storage_service.dart';
/// Implementation of StorageService using Hive Key-Value DB
class StorageServiceImpl implements StorageService {
@override
Future saveUser(User user) async {
@JEuler
JEuler / db_user.dart
Created Mar 15, 2020
Hive class of User model
View db_user.dart
import 'package:hive/hive.dart';
part 'db_user.g.dart';
// ignore_for_file: public_member_api_docs
@HiveType(typeId: 1)
class DBUser {
DBUser(this.id, this.name);
@JEuler
JEuler / user.dart
Created Mar 15, 2020
BuiltValue User model example
View user.dart
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'user_with_relations.dart';
part 'user.g.dart';
// ignore_for_file: public_member_api_docs
abstract class User implements Built<User, UserBuilder> {
@JEuler
JEuler / queuelist.dart
Created Mar 15, 2020
Basic queue in Dart
View queuelist.dart
import 'dart:collection';
/// Basic Queue (LIFO)
class QueueList<T> {
final ListQueue<T> _list = ListQueue();
/// Is empty?
bool get isEmpty => _list.isEmpty;
/// Not empty?
@JEuler
JEuler / stacklist.dart
Created Mar 11, 2020
Basic stack in Dart
View stacklist.dart
import 'dart:collection';
/// Basic Stack (FIFO)
class StackList<T> {
final ListQueue<T> _list = ListQueue();
/// Is empty?
bool get isEmpty => _list.isEmpty;
/// Not empty?
@JEuler
JEuler / dot_divider.dart
Last active Apr 6, 2020
DotDivider widget for Flutter
View dot_divider.dart
import 'package:flutter/material.dart';
/// Dot divider for Calendar
class DotDivider extends StatelessWidget {
/// Constructor
const DotDivider(
{this.height = 1, this.color = Colors.black, this.countCoeff = 3});
/// Color of divider
final Color color;
You can’t perform that action at this time.