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
@Composable | |
fun MapDrawer(onDrawingEnd : (List<Point>) -> Unit) { | |
var state by remember { mutableStateOf(MapPolygonState()) } | |
val brush = remember { SolidColor(Color.Black) } | |
val path = remember { Path() } | |
Canvas( | |
modifier = Modifier | |
.fillMaxSize() | |
.pointerInput(Unit) { | |
awaitEachGesture { |
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
enum class DrawerMotionEvent { idle, down, up, move } | |
data class MapDrawState( | |
val currentPosition: Offset = Offset.Unspecified, | |
val event: MotionEvent = MotionEvent.idle | |
) | |
@Composable | |
fun MapDrawer() { | |
var state by remember { mutableStateOf(MapDrawState()) } |
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
enum class DrawerMotionEvent { idle, down, up, move } | |
data class MapDrawState( | |
val currentPosition: Offset = Offset.Unspecified, | |
val event: MotionEvent = MotionEvent.idle | |
) | |
@Composable | |
fun MapDrawer() { | |
var state by remember { mutableStateOf(MapDrawState()) } |
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
@ExperimentalMaterialApi | |
@Composable | |
fun HomeScreen() { | |
val bottomSheetScaffoldState = rememberBottomSheetScaffoldState( | |
bottomSheetState = BottomSheetState(BottomSheetValue.Collapsed) | |
) | |
val coroutineScope = rememberCoroutineScope() | |
BottomSheetScaffold( | |
scaffoldState = bottomSheetScaffoldState, | |
sheetContent = { |
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
object LocaleHelper { | |
private val SELECTED_LANGUAGE = "app_lang" | |
fun onAttach(context: Context): Context { | |
val langu = getPersistedData(context, Locale.getDefault().language) | |
return setLocale(context, langu) | |
} | |
fun onAttach(context: Context, defaultLanguage: String): Context { |
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
public class Incrementor { | |
/** | |
* The current number | |
*/ | |
private int number = 0; | |
/** | |
* The maximum value that number can be | |
*/ | |
private int max = Integer.MAX_VALUE; |
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
import 'package:flutter/material.dart'; | |
import 'package:news_app/entity/news.dart'; | |
class ListItem extends StatelessWidget { | |
final Article article; | |
ListItem(this.article); | |
@override | |
Widget build(BuildContext context) { |
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
Expanded( | |
child: Padding( | |
padding: EdgeInsets.all(8), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text(article.title), | |
Text(article.description) | |
]), | |
), |
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 getData() async { | |
http.Response response = await http.get( | |
"https://newsapi.org/v2/top-headlines?country=us&apiKey=YOUR_API_KEY"); | |
setState(() { | |
_newsList = News.fromJson(json.decode(response.body)).articles; | |
}); | |
} |
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 getData() async { | |
var response = await http.get( | |
"https://newsapi.org/v2/top-headlines?country=us&apiKey=821a22ad51e240fb9c131c4b00009630"); | |
setState(() { | |
if (response.statusCode == 200) { | |
items.addAll(News.fromJson(json.decode(response.body)).articles); | |
} | |
}); | |
} |
NewerOlder