Skip to content

Instantly share code, notes, and snippets.

View DaniyarGilimov's full-sized avatar
💭
Dancing with mutexes

DaniyarGilimov

💭
Dancing with mutexes
View GitHub Profile
// PlayerListener used to listen player via websocket
func PlayerListener(pc *model.PlayerConn) {
defer func(pc *model.PlayerConn) {
if r := recover(); r != nil {
log.Println("Recovered in PlayerListener", r)
}
if !pc.WR {
log.Printf("closing in listener %d", pc.PlayerID)
@DaniyarGilimov
DaniyarGilimov / main.dart
Created July 8, 2019 16:33
Place to display the cards
import 'package:flutter/material.dart';
import 'package:flutter/animation.dart';
import 'package:animation_playground/classes/card.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@DaniyarGilimov
DaniyarGilimov / card.dart
Created July 8, 2019 16:29
Card widget, it's like a real playing card
import 'package:flutter/material.dart';
class CardItem extends StatefulWidget {
CardItem({Key key, this.color, this.value}) : super(key: key);
final int value;
final Color color;
_CardItemState createState() => _CardItemState();
}
@DaniyarGilimov
DaniyarGilimov / RootPage.dart
Last active June 22, 2019 10:17
RootPage where located bottomNavigationBar
class RootPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _RootPage();
}
}
class _RootPage extends State<RootPage> {
int _currentIndex = 0;
@DaniyarGilimov
DaniyarGilimov / MainTabOrDetailPage.dart
Created June 22, 2019 10:01
Navigation with rootPages' BuildContext
class MainTabOrDetailPage extends StatefulWidget {
final BuildContext rootContext;
StudentMainTab({@required this.rootContext});
@override
State<StatefulWidget> createState() {
return _MainTabOrDetailPage();
}
}
class _MainTabOrDetailPage extends State<MainTabOrDetailPage> {
@DaniyarGilimov
DaniyarGilimov / MainTab.dart
Created June 22, 2019 09:32
Navigator and MaterialPageRoute
Widget build(BuildContext context) {
return Navigator(
onGenerateRoute: (RouteSettings settings) {
return new MaterialPageRoute(
settings: settings,
builder: (BuildContext context) {
return Scaffold(
//List {Математика, Английский язык...}
);
});