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
// Other stuff ... | |
private lateinit var viewModelFactory: ViewModelFactory | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
initViews() | |
viewModelFactory = ViewModelFactory(NotesRepository(this)) |
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
// This is the NotesList activity Component (Which could be turned into a generic one) | |
component = DaggerNotesActivityComponent | |
.builder() | |
.notesActivityModule(NotesActivityModule(this)) // Extra step, since the module requires the context to provide a RecyclerViewAdapter | |
.notesApplicationComponent(NotesApplication.get(this).getComponent()) | |
.build() | |
// This is the EditorActivity Component (The one which would be deleted in favor of the generic one) | |
component = DaggerEditorActivityComponent | |
.builder() |
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
package com.vferreirati.cervejeiros.repository | |
import androidx.lifecycle.MutableLiveData | |
import com.vferreirati.cervejeiros.data.dao.BeerDao | |
import com.vferreirati.cervejeiros.data.model.Beer | |
import com.vferreirati.cervejeiros.services.PunkService | |
import com.vferreirati.cervejeiros.services.model.BeerResponse | |
import kotlinx.coroutines.experimental.Dispatchers | |
import kotlinx.coroutines.experimental.GlobalScope | |
import kotlinx.coroutines.experimental.launch |
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
class BeerListViewModel (private val beerRepository: BeerRepository): ViewModel(), CoroutineScope { | |
private var job = Job() | |
override val coroutineContext: CoroutineContext | |
get() = Dispatchers.IO + job | |
fun getBeers(): LiveData<List<BeerResponse>> { | |
val beers = MutableLiveData<List<BeerResponse>>() | |
launch { |
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:chopper/chopper.dart'; | |
part '$FILENAME$.chopper.dart'; | |
@ChopperApi(baseUrl: '') | |
abstract class $SERVICE_NAME$ extends ChopperService { | |
static $SERVICE_NAME$ create([ChopperClient client]) => _$$$SERVICE_NAME$(client); | |
// endpoints | |
} |
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
Future<Event<bool>> login(LoginModel loginModel) async { | |
try { | |
final loginResponse = await _authService.login(); | |
return SuccessEvent(data: true); | |
} catch(e) { | |
if(e is SocketException) { | |
// Usuário sem internet | |
} | |
} | |
} |
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 _onShareReceipt(context) async { | |
final data = await _onCaptureReceipt(); | |
// Utilizando o pacote "esys_flutter_share" para compartilhamento da imagem gerada | |
await Share.file('Comprovante de Venda', 'comprovante.png', data, 'image/png'); | |
} | |
Future<Uint8List> _onCaptureReceipt() async { | |
// _receiptKey é uma GlobalKey que foi atribuida ao Widget pelo qual desejo imprimir | |
RenderRepaintBoundary boundary = _receiptKey.currentContext.findRenderObject(); |
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
class _FirstSchedulePageState extends State<FirstSchedulePage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: AppColors.PAGE_BACKGROUND_COLOR, | |
body: _buildContent(), | |
); | |
} | |
Widget _buildContent() { |
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:agendador_mobile/src/core/resources/app_colors.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_screenutil/screenutil.dart'; | |
class MainText extends StatelessWidget { | |
final String text; | |
final FontWeight fontWeight; | |
final TextSize textSize; | |
final Color textColor; | |
final bool allCaps; |
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
private fun checkLocationPermission() { | |
TedPermission.create() | |
.setPermissionListener(object : PermissionListener { | |
override fun onPermissionDenied(deniedPermissions: MutableList<String>?) {} | |
override fun onPermissionGranted() { | |
viewModel.onAction(ScreenActions.OnLocationPermissionGranted) | |
} | |
}) | |
// ACCESS_FINE_LOCATION is being used due to the yuno SDK |